ManageIQ Ivanchuk fixes (#63948)
- manageiq-group: better handling if key not present - manageiq-tenant: ivanchuk api now returns ids as strings
This commit is contained in:
parent
3aaebba235
commit
5e9638c869
2 changed files with 10 additions and 13 deletions
|
@ -411,11 +411,7 @@ class ManageIQgroup(object):
|
|||
filters_updated = False
|
||||
new_filters_resource = {}
|
||||
|
||||
# Process belongsto filters
|
||||
if 'belongsto' in current_filters:
|
||||
current_belongsto_set = set(current_filters['belongsto'])
|
||||
else:
|
||||
current_belongsto_set = set()
|
||||
current_belongsto_set = current_filters.get('belongsto', set())
|
||||
|
||||
if belongsto_filters:
|
||||
new_belongsto_set = set(belongsto_filters)
|
||||
|
@ -501,11 +497,12 @@ class ManageIQgroup(object):
|
|||
|
||||
@staticmethod
|
||||
def manageiq_filters_to_sorted_dict(current_filters):
|
||||
if 'managed' not in current_filters:
|
||||
current_managed_filters = current_filters.get('managed')
|
||||
if not current_managed_filters:
|
||||
return None
|
||||
|
||||
res = {}
|
||||
for tag_list in current_filters['managed']:
|
||||
for tag_list in current_managed_filters:
|
||||
tag_list.sort()
|
||||
key = tag_list[0].split('/')[2]
|
||||
res[key] = tag_list
|
||||
|
@ -547,11 +544,11 @@ class ManageIQgroup(object):
|
|||
belongsto_filters = None
|
||||
if 'filters' in group['entitlement']:
|
||||
filters = group['entitlement']['filters']
|
||||
if 'belongsto' in filters:
|
||||
belongsto_filters = filters['belongsto']
|
||||
if 'managed' in filters:
|
||||
belongsto_filters = filters.get('belongsto')
|
||||
group_managed_filters = filters.get('managed')
|
||||
if group_managed_filters:
|
||||
managed_filters = {}
|
||||
for tag_list in filters['managed']:
|
||||
for tag_list in group_managed_filters:
|
||||
key = tag_list[0].split('/')[2]
|
||||
tags = []
|
||||
for t in tag_list:
|
||||
|
|
|
@ -221,7 +221,7 @@ class ManageIQTenant(object):
|
|||
self.module.fail_json(msg="Multiple parent tenants not found in manageiq with name '%s" % parent)
|
||||
|
||||
parent_tenant = parent_tenant_res[0]
|
||||
parent_id = parent_tenant['id']
|
||||
parent_id = int(parent_tenant['id'])
|
||||
tenants = self.client.collections.tenants.find_by(name=name)
|
||||
|
||||
for tenant in tenants:
|
||||
|
@ -448,7 +448,7 @@ class ManageIQTenant(object):
|
|||
|
||||
try:
|
||||
ancestry = tenant['ancestry']
|
||||
tenant_parent_id = int(ancestry.split("/")[-1])
|
||||
tenant_parent_id = ancestry.split("/")[-1]
|
||||
except AttributeError:
|
||||
# The root tenant does not return the ancestry attribute
|
||||
tenant_parent_id = None
|
||||
|
|
Loading…
Reference in a new issue