catch no rapt token from gcloud.

This commit is contained in:
Jay Lee
2023-08-02 18:22:39 +00:00
parent 78fc9b0478
commit a526d519bd

View File

@ -4512,7 +4512,10 @@ def refreshCredentialsWithReauth(credentials):
f'SELECT rapt_token FROM access_tokens WHERE account_id = "{admin_email}"') f'SELECT rapt_token FROM access_tokens WHERE account_id = "{admin_email}"')
except TypeError: except TypeError:
systemErrorExit(SYSTEM_ERROR_RC, systemErrorExit(SYSTEM_ERROR_RC,
f'ERROR: failed to run gcloud as {admin_email}. Please make sure it\'s setup') f'failed to run gcloud as {admin_email}. Please make sure it\'s setup')
if not credentials._rapt_token:
systemErrorExit(SYSTEM_ERROR_RC,
f'failed to retrieve reauth token from gcloud. You may need to wait until gcloud is also prompted for reauth.')
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.