Resolve unorderable types errors
Python 3 raises errors when attempting to compare types that don't have a meaningful natural ordering. If a processed file does not belong to a role it's not neccessary to create a mapping of a project_group for a `None` role, to prevent 'None' from being compared to other string role names within the 'role_project_groups' dict. For variables containing lists of dictionaries, like 'remote_package_parts', sort using the 'name' property of each dictionary. Change-Id: I9ec4b0b3b7236450f19c1d6186eb310fb7f1e083 Implements: blueprint goal-python35
This commit is contained in:
parent
60363db63b
commit
8685a0ba38
@ -552,6 +552,7 @@ class DependencyFileProcessor(object):
|
|||||||
else:
|
else:
|
||||||
project_group = 'all'
|
project_group = 'all'
|
||||||
|
|
||||||
|
if role_name is not None:
|
||||||
PACKAGE_MAPPING['role_project_groups'][role_name] = project_group
|
PACKAGE_MAPPING['role_project_groups'][role_name] = project_group
|
||||||
for key, values in loaded_config.items():
|
for key, values in loaded_config.items():
|
||||||
key = key.lower()
|
key = key.lower()
|
||||||
@ -750,6 +751,9 @@ class LookupModule(BASECLASS):
|
|||||||
# Sort everything within the returned data
|
# Sort everything within the returned data
|
||||||
for key, value in return_data.items():
|
for key, value in return_data.items():
|
||||||
if isinstance(value, (list, set)):
|
if isinstance(value, (list, set)):
|
||||||
|
if all(isinstance(item, dict) for item in value):
|
||||||
|
return_data[key] = sorted(value, key = lambda k: k['name'])
|
||||||
|
else:
|
||||||
return_data[key] = sorted(value)
|
return_data[key] = sorted(value)
|
||||||
return_data['role_requirement_files'] = ROLE_REQUIREMENTS
|
return_data['role_requirement_files'] = ROLE_REQUIREMENTS
|
||||||
return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS
|
return_data['role_requirements'] = ROLE_BREAKOUT_REQUIREMENTS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user