From cc65b8477b7637869326eb53e66a103123132f46 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 30 Aug 2018 10:27:29 -0400 Subject: [PATCH] Allow home path expansion on GCP service account files (#44863) * Allowing home path expansion on GCP service account files #42974 * wrong name for changelog --- plugins/module_utils/gcp_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 8bc6d92..4c50feb 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -125,8 +125,8 @@ class GcpSession(object): credentials, project_id = google.auth.default() return credentials elif cred_type == 'serviceaccount': - return service_account.Credentials.from_service_account_file( - self.module.params['service_account_file']) + path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file'])) + return service_account.Credentials.from_service_account_file(path) elif cred_type == 'machineaccount': return google.auth.compute_engine.Credentials( self.module.params['service_account_email'])