fix project creation for @gmail.com accounts

This commit is contained in:
Jay Lee
2020-06-18 11:17:46 -04:00
parent 73677544a3
commit 0e5635cc2a
2 changed files with 11 additions and 6 deletions

View File

@@ -7306,12 +7306,15 @@ def setGAMProjectConsentScreen(httpObj, projectId, login_hint):
print('Setting GAM project consent screen...') print('Setting GAM project consent screen...')
iap = getService('iap', httpObj) iap = getService('iap', httpObj)
body = {'applicationTitle': 'GAM', 'supportEmail': login_hint} body = {'applicationTitle': 'GAM', 'supportEmail': login_hint}
throw_reasons = [
gapi_errors.ErrorReason.FOUR_O_NINE, gapi_errors.ErrorReason.FOUR_O_O
]
try: try:
gapi.call(iap.projects().brands(), gapi.call(iap.projects().brands(),
'create', 'create',
parent=f'projects/{projectId}', parent=f'projects/{projectId}',
body=body, body=body,
throw_reasons=[gapi_errors.ErrorReason.FOUR_O_NINE]) throw_reasons=throw_reasons)
except googleapiclient.errors.HttpError: except googleapiclient.errors.HttpError:
pass pass
@@ -13390,11 +13393,12 @@ def ProcessGAMCommand(args):
f'Here are the first {num_items} commands GAM will run (note that quoting may be lost/invalid in this output):\n' f'Here are the first {num_items} commands GAM will run (note that quoting may be lost/invalid in this output):\n'
) )
for i in range(num_items): for i in range(num_items):
c = ' '.join([item if (item and c = ' '.join([
(item.find(' ') == -1) and item if (item and (item.find(' ') == -1) and
(item.find(',') == -1) and (item.find(',') == -1) and
(item.find("'") == -1)) (item.find("'") == -1)) else '"' + item + '"'
else '"'+item+'"' for item in items[i]]) for item in items[i]
])
print(f' {c}') print(f' {c}')
sys.exit(0) sys.exit(0)
elif command == 'version': elif command == 'version':

View File

@@ -117,6 +117,7 @@ class ErrorReason(Enum):
FAILED_PRECONDITION = 'failedPrecondition' FAILED_PRECONDITION = 'failedPrecondition'
FORBIDDEN = 'forbidden' FORBIDDEN = 'forbidden'
FOUR_O_NINE = '409' FOUR_O_NINE = '409'
FOUR_O_O = '400'
FOUR_O_THREE = '403' FOUR_O_THREE = '403'
FOUR_TWO_NINE = '429' FOUR_TWO_NINE = '429'
GATEWAY_TIMEOUT = 'gatewayTimeout' GATEWAY_TIMEOUT = 'gatewayTimeout'