From f813a8474b9313823cee4d61991ed312a20e18a9 Mon Sep 17 00:00:00 2001 From: jayme-github Date: Mon, 16 Jan 2017 15:10:16 +0100 Subject: [PATCH] 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. --- lib/ansible/module_utils/gcp.py | 4 ++-- lib/ansible/modules/cloud/google/gce.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/gcp.py b/lib/ansible/module_utils/gcp.py index 91c32d58ba..3e662d3bf1 100644 --- a/lib/ansible/module_utils/gcp.py +++ b/lib/ansible/module_utils/gcp.py @@ -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"), diff --git a/lib/ansible/modules/cloud/google/gce.py b/lib/ansible/modules/cloud/google/gce.py index b89be8dba2..6c95b6eeb8 100644 --- a/lib/ansible/modules/cloud/google/gce.py +++ b/lib/ansible/modules/cloud/google/gce.py @@ -637,8 +637,8 @@ def main(): zone = dict(default='us-central1-a'), service_account_email = dict(), service_account_permissions = dict(type='list'), - pem_file = dict(), - credentials_file = dict(), + pem_file = dict(type='path'), + credentials_file = dict(type='path'), project_id = dict(), ip_forward = dict(type='bool', default=False), external_ip=dict(default='ephemeral'),