mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixing policy sorting for Python 3
This commit is contained in:
parent
c1f0260ae3
commit
3c3e9c3b36
1 changed files with 3 additions and 1 deletions
|
@ -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 = {}
|
||||
|
|
Loading…
Reference in a new issue