From 5c0b94217e521891ff68c048671b097fc9b6d2b8 Mon Sep 17 00:00:00 2001 From: Maciej Lasyk Date: Wed, 30 Aug 2017 20:46:45 +0200 Subject: [PATCH] Added handling optional GCE_CREDENTIALS_FILE_PATH (#25526) Ansible documentation states that env variable based authentication bases on variable GCE_CREDENTIALS_FILE_PATH while gce.py reads only GCE_PEM_FILE_PATH (see https://docs.ansible.com/ansible/guide_gce.html). This commit adds GCE_CREDENTIALS_FILE_PATH to the configuration chain; if set it will be used. --- contrib/inventory/gce.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/inventory/gce.py b/contrib/inventory/gce.py index a1e72dac7f3..9a0cef0b598 100755 --- a/contrib/inventory/gce.py +++ b/contrib/inventory/gce.py @@ -309,6 +309,8 @@ class GceInventory(object): # other configuration; process those into our args and kwargs. args[0] = os.environ.get('GCE_EMAIL', args[0]) args[1] = os.environ.get('GCE_PEM_FILE_PATH', args[1]) + args[1] = os.environ.get('GCE_CREDENTIALS_FILE_PATH', args[1]) + kwargs['project'] = os.environ.get('GCE_PROJECT', kwargs['project']) kwargs['datacenter'] = os.environ.get('GCE_ZONE', kwargs['datacenter'])