def TestGcloudUpToDate()

in image_test/configuration/linux/generic_distro.py [0:0]


  def TestGcloudUpToDate(self):
    """
    Test for gcloud/gsutil (some distros won't have this) and validate that
    versions are up to date.

    https://github.com/GoogleCloudPlatform/compute-image-tools/issues/400
    """
    # firstly check if gcloud and gsutil are available
    try:
      rc_gcloud, output = utils.Execute(['gcloud'], raise_errors=False)
      rc_gsutil, output = utils.Execute(['gsutil'], raise_errors=False)
    except OSError as e:
      if e.errno == 2:  # No such file or directory
        # command is not available, skip this test
        return
      raise e

    # Avoid log output overload on centos-6
    time.sleep(1)
    # now test if their API are still valid
    utils.Execute(['gcloud', 'compute', 'images', 'list'])

    # Avoid log output overload on centos-6
    time.sleep(1)
    utils.Execute(['gsutil', 'ls'])
    time.sleep(1)