From c5adf08c40db740e1481130b97c206ab371b31d0 Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Tue, 9 May 2017 15:03:22 +0200 Subject: [PATCH] Reference correct variable and key for role expiry (#23397) Previously, this module could throw the following error message: NameError: global name 'current_roles_attrs' is not defined The referencing key should also match the name of the column, which is rolvaliduntil, not rol_valid_until --- lib/ansible/modules/database/postgresql/postgresql_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py index e31ebf19b39..48d5799eca2 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_user.py +++ b/lib/ansible/modules/database/postgresql/postgresql_user.py @@ -321,7 +321,7 @@ def user_alter(cursor, module, user, password, role_attr_flags, encrypted, expir if current_role_attrs[PRIV_TO_AUTHID_COLUMN[role_attr_name]] != role_attr_value: role_attr_flags_changing = True - expires_changing = (expires is not None and expires == current_roles_attrs['rol_valid_until']) + expires_changing = (expires is not None and expires == current_role_attrs['rolvaliduntil']) if not pwchanging and not role_attr_flags_changing and not expires_changing: return False