GCE contract update, do not use token_uri in job runs

This commit is contained in:
AlanCoding 2019-05-20 09:27:45 -04:00
parent f174902bb2
commit 74643520c7
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B
3 changed files with 10 additions and 9 deletions

View File

@ -19,18 +19,19 @@ def gce(cred, env, private_data_dir):
project = cred.get_input('project', default='')
username = cred.get_input('username', default='')
if 'INVENTORY_UPDATE_ID' not in env:
env['GCE_EMAIL'] = username
env['GCE_PROJECT'] = project
json_cred = {
'type': 'service_account',
'private_key': cred.get_input('ssh_key_data', default=''),
'client_email': username,
'project_id': project,
# need token uri for inventory plugins
# should this really be hard coded? Good question.
'token_uri': 'https://accounts.google.com/o/oauth2/token',
'project_id': project
}
if 'INVENTORY_UPDATE_ID' not in env:
env['GCE_EMAIL'] = username
env['GCE_PROJECT'] = project
else:
# gcp_compute inventory plugin requires token_uri
# although it probably should not, since gce_modules do not
json_cred['token_uri'] = 'https://oauth2.googleapis.com/token'
handle, path = tempfile.mkstemp(dir=private_data_dir)
f = os.fdopen(handle, 'w')

View File

@ -3,5 +3,5 @@
"private_key": "{{private_key}}",
"client_email": "fooo",
"project_id": "fooo",
"token_uri": "https://accounts.google.com/o/oauth2/token"
"token_uri": "https://oauth2.googleapis.com/token"
}

View File

@ -3,5 +3,5 @@
"private_key": "{{private_key}}",
"client_email": "fooo",
"project_id": "fooo",
"token_uri": "https://accounts.google.com/o/oauth2/token"
"token_uri": "https://oauth2.googleapis.com/token"
}