mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Fixing policy sorting for Python 3
This commit is contained in:
@@ -570,7 +570,9 @@ def sort_json_policy_dict(policy_dict):
|
||||
else:
|
||||
checked_list.append(item)
|
||||
|
||||
checked_list.sort()
|
||||
# Sort list. If it's a list of dictionaries, sort by tuple of key-value
|
||||
# pairs, since Python 3 doesn't allow comparisons such as `<` between dictionaries.
|
||||
checked_list.sort(key=lambda x: sorted(x.items()) if isinstance(x, dict) else x)
|
||||
return checked_list
|
||||
|
||||
ordered_policy_dict = {}
|
||||
|
||||
Reference in New Issue
Block a user