Remove warning while looking up project_id (#184)

This commit is contained in:
Mike Moore 2018-12-27 16:09:51 -07:00 committed by GitHub
parent 8894a08470
commit dc8b127549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -139,13 +139,14 @@ module Google
end end
module_function :warn_if_cloud_sdk_credentials module_function :warn_if_cloud_sdk_credentials
# Finds project_id from gcloud CLI configuration
def load_gcloud_project_id def load_gcloud_project_id
gcloud = GCLOUD_WINDOWS_COMMAND if OS.windows? gcloud = GCLOUD_WINDOWS_COMMAND if OS.windows?
gcloud = GCLOUD_POSIX_COMMAND unless OS.windows? gcloud = GCLOUD_POSIX_COMMAND unless OS.windows?
config = MultiJson.load(`#{gcloud} #{GCLOUD_CONFIG_COMMAND}`) config = MultiJson.load(`#{gcloud} #{GCLOUD_CONFIG_COMMAND}`)
config['configuration']['properties']['core']['project'] config['configuration']['properties']['core']['project']
rescue rescue
warn 'Unable to determine project id.' nil
end end
module_function :load_gcloud_project_id module_function :load_gcloud_project_id