Allow home path expansion on GCP service account files ()

* Allowing home path expansion on GCP service account files 

* wrong name for changelog
This commit is contained in:
Alex Stephen 2018-08-30 10:27:29 -04:00 committed by Ryan Brown
parent bf9ed0263a
commit 3c6c7bae9d
2 changed files with 4 additions and 2 deletions
changelogs/fragments
lib/ansible/module_utils

View file

@ -0,0 +1,2 @@
minor_changes:
- GCP Modules will do home path expansion on service account file paths

View file

@ -129,8 +129,8 @@ class GcpSession(object):
credentials, project_id = google.auth.default() credentials, project_id = google.auth.default()
return credentials return credentials
elif cred_type == 'serviceaccount': elif cred_type == 'serviceaccount':
return service_account.Credentials.from_service_account_file( path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file']))
self.module.params['service_account_file']) return service_account.Credentials.from_service_account_file(path)
elif cred_type == 'machineaccount': elif cred_type == 'machineaccount':
return google.auth.compute_engine.Credentials( return google.auth.compute_engine.Credentials(
self.module.params['service_account_email']) self.module.params['service_account_email'])