Specify key to use while sorting permissions (#49126)

Without specifying the dictionary key to use while sorting it will fail
in Python 3 environments due to simplifying Python's rules for ordering
comparisons: https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons
pull/49390/head
Gregor Wegberg 6 years ago committed by John R Barker
parent 19035dbcb2
commit 4096d74245

@ -117,6 +117,7 @@ EXAMPLES = '''
write_priv: .*
state: present
'''
import operator
from ansible.module_utils.basic import AnsibleModule
@ -230,7 +231,8 @@ class RabbitMqUser(object):
return set(self.tags) != set(self._tags)
def has_permissions_modifications(self):
return sorted(self._permissions) != sorted(self.permissions)
sort_key_fetch = operator.itemgetter('vhost')
return sorted(self._permissions, key=sort_key_fetch) != sorted(self.permissions, key=sort_key_fetch)
def main():

Loading…
Cancel
Save