Have doCreateProject find proper JSON files (#318)

As in https://github.com/jay0lee/GAM/pull/313, factor in the user's
environment variables. On a new installation, the files will be in GAM
Path, but on an existing installation the environment variables may
have them located somewhere else.
This commit is contained in:
Ross Scroggs
2016-11-07 07:21:55 -08:00
committed by Jay Lee
parent 6a179215d6
commit d75a5e78a5

View File

@@ -6920,7 +6920,7 @@ and accept the Terms of Service (ToS). As soon as you've accepted the ToS popup,
body = {u'privateKeyType': u'TYPE_GOOGLE_CREDENTIALS_FILE', u'keyAlgorithm': u'KEY_ALG_RSA_4096'}
key = callGAPI(iam.projects().serviceAccounts().keys(), u'create', name=service_account[u'name'], body=body)
oauth2service_data = base64.b64decode(key[u'privateKeyData'])
service_account_file = os.path.join(GM_Globals[GM_GAM_PATH], FN_OAUTH2SERVICE_JSON)
service_account_file = GC_Values[GC_OAUTH2SERVICE_JSON]
if os.path.isfile(service_account_file):
service_account_file = u'%s-%s' % (service_account_file, project_id)
writeFile(service_account_file, oauth2service_data, continueOnError=False)
@@ -6953,7 +6953,7 @@ and accept the Terms of Service (ToS). As soon as you've accepted the ToS popup,
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}''' % (client_id, client_secret, project_id)
client_secrets_file = os.path.join(GM_Globals[GM_GAM_PATH], FN_CLIENT_SECRETS_JSON)
client_secrets_file = GC_Values[GC_CLIENT_SECRETS_JSON]
if os.path.isfile(client_secrets_file):
client_secrets_file = u'%s-%s' % (client_secrets_file, project_id)
writeFile(client_secrets_file, cs_data, continueOnError=False)