Updated gam delete ou and gam print admins to handle the following error:

ERROR: 503: serviceNotAvailable - The service is currently unavailable.
This commit is contained in:
Ross Scroggs
2024-09-18 07:14:53 -07:00
parent 7958632046
commit abb49ed336
2 changed files with 15 additions and 5 deletions

View File

@@ -8,6 +8,11 @@ where 7.00.02 MacOS builds usually took ~7 seconds to run "gam version", 7.00.03
MacOS builds are now signed by Jay's Apple Developer ID and notarized (scanned for malware) by Apple. This
should resolve MacOS security warnings that need to be overridden when running GAM.
Updated `gam delete ou` and `gam print admins` to handle the following error:
```
ERROR: 503: serviceNotAvailable - The service is currently unavailable.
```
7.00.02
Added option `showlastmodification` to `gam <UserTypeEntity> print|show filecounts` that adds

View File

@@ -16623,13 +16623,15 @@ def doPrintShowAdmins():
try:
admins = callGAPIpages(cd.roleAssignments(), 'list', 'items',
pageMessage=getPageMessage(),
throwReasons=[GAPI.INVALID, GAPI.USER_NOT_FOUND, GAPI.BAD_REQUEST,
GAPI.CUSTOMER_NOT_FOUND, GAPI.FORBIDDEN],
throwReasons=[GAPI.INVALID, GAPI.USER_NOT_FOUND,
GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE,
GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
customer=GC.Values[GC.CUSTOMER_ID], fields=fields, **kwargs)
except (GAPI.invalid, GAPI.userNotFound):
entityUnknownWarning(Ent.ADMINISTRATOR, userKey)
return
except GAPI.forbidden as e:
except (GAPI.forbidden, GAPI.serviceNotAvailable) as e:
entityActionFailedExit([Ent.ADMINISTRATOR, userKey, Ent.ADMIN_ROLE, roleId], str(e))
except (GAPI.badRequest, GAPI.customerNotFound):
accessErrorExit(cd)
@@ -17334,14 +17336,17 @@ def _doDeleteOrgs(entityList):
try:
orgUnitPath = makeOrgUnitPathAbsolute(orgUnitPath)
callGAPI(cd.orgunits(), 'delete',
throwReasons=[GAPI.CONDITION_NOT_MET, GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR, GAPI.BAD_REQUEST, GAPI.INVALID_CUSTOMER_ID, GAPI.LOGIN_REQUIRED],
throwReasons=[GAPI.CONDITION_NOT_MET, GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR,
GAPI.INVALID_CUSTOMER_ID, GAPI.SERVICE_NOT_AVAILABLE,
GAPI.BAD_REQUEST, GAPI.LOGIN_REQUIRED],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=encodeOrgUnitPath(makeOrgUnitPathRelative(orgUnitPath)))
entityActionPerformed([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], i, count)
except GAPI.conditionNotMet:
entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.HAS_CHILD_ORGS.format(Ent.Plural(Ent.ORGANIZATIONAL_UNIT)), i, count)
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.DOES_NOT_EXIST, i, count)
except GAPI.invalidCustomerId as e:
except (GAPI.invalidCustomerId, GAPI.serviceNotAvailable) as e:
### Check for my_customer
entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath, Ent.CUSTOMER_ID, GC.Values[GC.CUSTOMER_ID]], str(e), i, count)
except (GAPI.badRequest, GAPI.loginRequired):