Bugfix of 65761: postgresql_privs fail after it's updated to 2.9.2 (#65903)

* Bugfix of 65761: postgresql_privs fail after it's updated to 2.9.2

* add changelog
This commit is contained in:
Andrew Klychkov 2019-12-17 16:53:51 +03:00 committed by John R Barker
parent ec0885cf05
commit 9b85a51c64
2 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- postgresql_privs - fix sorting lists with None elements for python3 (https://github.com/ansible/ansible/issues/65761).

View file

@ -780,8 +780,16 @@ class Connection(object):
executed_queries.append(query)
self.cursor.execute(query)
status_after = get_status(objs)
status_before.sort()
status_after.sort()
def nonesorted(e):
# For python 3+ that can fail trying
# to compare NoneType elements by sort method.
if e is None:
return ''
return e
status_before.sort(key=nonesorted)
status_after.sort(key=nonesorted)
return status_before != status_after