def checkOrgUnitPathExists(cd, orgUnitPath, i=0, count=0, showError=False):
if orgUnitPath == u'/':
return (True, orgUnitPath)
try:
return (True, callGAPI(cd.orgunits(), u'get',
throw_reasons=[GAPI.INVALID_ORGUNIT, GAPI.ORGUNIT_NOT_FOUND, GAPI.BACKEND_ERROR, GAPI.BAD_REQUEST, GAPI.INVALID_CUSTOMER_ID, GAPI.LOGIN_REQUIRED],
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=makeOrgUnitPathRelative(orgUnitPath),
fields=u'orgUnitPath')[u'orgUnitPath'])
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
pass
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
errMsg = accessErrorMessage(cd)
if errMsg:
systemErrorExit(INVALID_DOMAIN_RC, errMsg)
if showError:
entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.DOES_NOT_EXIST, i, count)
return (False, orgUnitPath)
评论列表
文章目录