mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
State what we don't like about invalid JSON
This commit is contained in:
@@ -871,9 +871,9 @@ def getSvcAcctCredentials(scopes, act_as, api=None):
|
|||||||
GM_Globals[GM_OAUTH2SERVICE_ACCOUNT_CLIENT_ID] = GM_Globals[
|
GM_Globals[GM_OAUTH2SERVICE_ACCOUNT_CLIENT_ID] = GM_Globals[
|
||||||
GM_OAUTH2SERVICE_JSON_DATA]['client_id']
|
GM_OAUTH2SERVICE_JSON_DATA]['client_id']
|
||||||
return credentials
|
return credentials
|
||||||
except (ValueError, KeyError):
|
except (ValueError, KeyError) as err:
|
||||||
printLine(MESSAGE_INSTRUCTIONS_OAUTH2SERVICE_JSON)
|
printLine(MESSAGE_INSTRUCTIONS_OAUTH2SERVICE_JSON)
|
||||||
controlflow.invalid_json_exit(GC_Values[GC_OAUTH2SERVICE_JSON])
|
controlflow.invalid_json_exit(GC_Values[GC_OAUTH2SERVICE_JSON], err)
|
||||||
|
|
||||||
|
|
||||||
def getAPIVersion(api):
|
def getAPIVersion(api):
|
||||||
@@ -899,8 +899,8 @@ def readDiscoveryFile(api_version):
|
|||||||
try:
|
try:
|
||||||
discovery = json.loads(json_string)
|
discovery = json.loads(json_string)
|
||||||
return (disc_file, discovery)
|
return (disc_file, discovery)
|
||||||
except ValueError:
|
except ValueError as err:
|
||||||
controlflow.invalid_json_exit(disc_file)
|
controlflow.invalid_json_exit(disc_file, err)
|
||||||
|
|
||||||
|
|
||||||
def getOauth2TxtStorageCredentials():
|
def getOauth2TxtStorageCredentials():
|
||||||
@@ -7889,7 +7889,7 @@ def doCreateOrRotateServiceAccountKeys(iam=None,
|
|||||||
i += 1
|
i += 1
|
||||||
elif myarg == 'yubikeyslot':
|
elif myarg == 'yubikeyslot':
|
||||||
new_data['yubikey_slot'] = sys.argv[i+1].upper()
|
new_data['yubikey_slot'] = sys.argv[i+1].upper()
|
||||||
i =+ 2
|
i += 2
|
||||||
elif myarg == 'yubikeypin':
|
elif myarg == 'yubikeypin':
|
||||||
new_data['yubikey_pin'] = input('Enter your YubiKey PIN: ')
|
new_data['yubikey_pin'] = input('Enter your YubiKey PIN: ')
|
||||||
i += 1
|
i += 1
|
||||||
|
|||||||
@@ -65,9 +65,12 @@ def csv_field_error_exit(field_name, field_names):
|
|||||||
','.join(field_names)))
|
','.join(field_names)))
|
||||||
|
|
||||||
|
|
||||||
def invalid_json_exit(file_name):
|
def invalid_json_exit(file_name, err=None):
|
||||||
"""Raises a system exit when invalid JSON content is encountered."""
|
"""Raises a system exit when invalid JSON content is encountered."""
|
||||||
system_error_exit(17, MESSAGE_INVALID_JSON.format(file_name))
|
err_msg = MESSAGE_INVALID_JSON.format(file_name)
|
||||||
|
if err:
|
||||||
|
err_msg += f'\n\n{err}'
|
||||||
|
system_error_exit(17, err_msg)
|
||||||
|
|
||||||
|
|
||||||
def wait_on_failure(current_attempt_num,
|
def wait_on_failure(current_attempt_num,
|
||||||
|
|||||||
Reference in New Issue
Block a user