in customizations/AccountFactory/BatchUpdate/update_pp.py [0:0]
def list_all_ou():
'''List all OUs in an organization'''
org_info = list()
root_id = list_org_roots()
try:
child_dict = ORG.list_children(ParentId=root_id, ChildType='ORGANIZATIONAL_UNIT')
child_list = child_dict['Children']
except Exception as exe:
error_and_exit('Unable to get children list' + str(exe))
while 'NextToken' in child_dict:
next_token = child_dict['NextToken']
try:
child_dict = ORG.list_children(ParentId=root_id, \
ChildType='ORGANIZATIONAL_UNIT', NextToken=next_token)
child_list += child_dict['Children']
except Exception as exe:
error_and_exit('Unable to get complete children list' + str(exe))
for item in child_list:
org_info.append(item['Id'])
if len(org_info) == 0:
error_and_exit('No Organizational Units Found')
return org_info