mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +00:00
catch error if gcloud is installed but not authenticated as GAM admin
This commit is contained in:
@@ -4505,8 +4505,13 @@ def refreshCredentialsWithReauth(credentials):
|
|||||||
raise KeyboardInterrupt
|
raise KeyboardInterrupt
|
||||||
token_path = gcloud_path_result.stdout.decode().strip()
|
token_path = gcloud_path_result.stdout.decode().strip()
|
||||||
token_file = f'{token_path}/access_tokens.db'
|
token_file = f'{token_path}/access_tokens.db'
|
||||||
|
admin_email = _getAdminEmail()
|
||||||
|
try:
|
||||||
credentials._rapt_token = runSqliteQuery(token_file,
|
credentials._rapt_token = runSqliteQuery(token_file,
|
||||||
f'SELECT rapt_token FROM access_tokens WHERE account_id = "{_getAdminEmail()}"')
|
f'SELECT rapt_token FROM access_tokens WHERE account_id = "{admin_email}"')
|
||||||
|
except TypeError:
|
||||||
|
systemErrorExit(SYSTEM_ERROR_RC,
|
||||||
|
f'ERROR: failed to run gcloud as {admin_email}. Please make sure it\'s setup')
|
||||||
|
|
||||||
def getClientCredentials(forceRefresh=False, forceWrite=False, filename=None, api=None, noDASA=False, refreshOnly=False, noScopes=False):
|
def getClientCredentials(forceRefresh=False, forceWrite=False, filename=None, api=None, noDASA=False, refreshOnly=False, noScopes=False):
|
||||||
"""Gets OAuth2 credentials which are guaranteed to be fresh and valid.
|
"""Gets OAuth2 credentials which are guaranteed to be fresh and valid.
|
||||||
|
|||||||
Reference in New Issue
Block a user