mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Fix crm org retrieval
This commit is contained in:
@@ -13,12 +13,14 @@ def get_org_id():
|
|||||||
gapi_directory_customer.setTrueCustomerId()
|
gapi_directory_customer.setTrueCustomerId()
|
||||||
crm = build()
|
crm = build()
|
||||||
query = f'directorycustomerid:{GC_Values[GC_CUSTOMER_ID]}'
|
query = f'directorycustomerid:{GC_Values[GC_CUSTOMER_ID]}'
|
||||||
orgs = gapi.get_all_pages(crm.organizations(),
|
results = gapi.call(crm.organizations(),
|
||||||
'search',
|
'search',
|
||||||
'organizations',
|
pageSize=1,
|
||||||
|
fields='organizations/name',
|
||||||
query=query)
|
query=query)
|
||||||
if len(orgs) < 1:
|
orgs = results.get('organizations')
|
||||||
|
if not orgs:
|
||||||
# return nothing and let calling API deal with it
|
# return nothing and let calling API deal with it
|
||||||
# since caller knows what GCP role would serve best
|
# since caller knows what GCP role would serve best
|
||||||
return
|
return
|
||||||
return orgs[0]['name']
|
return orgs[0].get('name')
|
||||||
|
|||||||
Reference in New Issue
Block a user