From 7b18723858c991d4143734f7266d06c5b017c06b Mon Sep 17 00:00:00 2001 From: Andrey Klychkov Date: Wed, 4 Dec 2019 01:57:02 +0300 Subject: [PATCH] Fix postgres_user not commiting changes when groups is set (#64835) --- ...gresql_user_fix_not_commiting_changes_when_groups_is_set.yml | 2 ++ lib/ansible/modules/database/postgresql/postgresql_user.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/64807-postgresql_user_fix_not_commiting_changes_when_groups_is_set.yml diff --git a/changelogs/fragments/64807-postgresql_user_fix_not_commiting_changes_when_groups_is_set.yml b/changelogs/fragments/64807-postgresql_user_fix_not_commiting_changes_when_groups_is_set.yml new file mode 100644 index 00000000000..fcfc7d54c6f --- /dev/null +++ b/changelogs/fragments/64807-postgresql_user_fix_not_commiting_changes_when_groups_is_set.yml @@ -0,0 +1,2 @@ +bugfixes: +- postgresql_user - fix the module doesn't correctly commit changes if groups is set (https://github.com/ansible/ansible/issues/64806). diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py index 1ad57a7ccaf..4a2f660637a 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_user.py +++ b/lib/ansible/modules/database/postgresql/postgresql_user.py @@ -940,7 +940,7 @@ def main(): target_roles = [] target_roles.append(user) pg_membership = PgMembership(module, cursor, target_roles, groups) - changed = pg_membership.grant() + changed = pg_membership.grant() or changed else: if user_exists(cursor, user):