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
This commit is contained in:
parent
19035dbcb2
commit
4096d74245
1 changed files with 3 additions and 1 deletions
|
@ -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…
Reference in a new issue