Allow the use of paths like ~/.project.json (#16064)

* Allow the use of paths like ~/.project.json

This makes it easy to manage credentials files outside of the repo
(and/or user specific credentials).

* Fix format string to log credentials_file.
This commit is contained in:
jayme-github 2017-01-16 15:10:16 +01:00 committed by Brian Coca
commit f813a8474b
2 changed files with 4 additions and 4 deletions

View file

@ -240,11 +240,11 @@ def _validate_credentials_file(module, credentials_file, require_valid_json=True
'Upgrade to libcloud>=0.17.0.')
return True
except IOError as e:
module.fail_json(msg='GCP Credentials File %s not found.', changed=False)
module.fail_json(msg='GCP Credentials File %s not found.' % credentials_file, changed=False)
return False
except ValueError as e:
if require_valid_json:
module.fail_json(msg='GCP Credentials File %s invalid. Must be valid JSON.', changed=False)
module.fail_json(msg='GCP Credentials File %s invalid. Must be valid JSON.' % credentials_file, changed=False)
else:
display.deprecated(msg=("Non-JSON credentials file provided. This format is deprecated. "
" Please generate a new JSON key from the Google Cloud console"),