Skip to content

Commit

Permalink
Revert "postgresql_user: fix bugs related to 'expires' option (backport
Browse files Browse the repository at this point in the history
#23862) (#26539)"

This reverts commit 5432414.
  • Loading branch information
abadger committed Jul 7, 2017
1 parent 5432414 commit 23020bf
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/ansible/modules/database/postgresql/postgresql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def user_alter(cursor, module, user, password, role_attr_flags, encrypted, expir
return False

# Handle passwords.
if not no_password_changes and (password is not None or role_attr_flags != '' or expires is not None):
if not no_password_changes and (password is not None or role_attr_flags != ''):
# Select password and all flag-like columns in order to verify changes.
query_password_data = dict(password=password, expires=expires)
select = "SELECT * FROM pg_authid where rolname=%(user)s"
Expand Down Expand Up @@ -314,12 +314,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

if expires is not None:
cursor.execute("SELECT %s::timestamptz;", (expires,))
expires_with_tz = cursor.fetchone()[0]
expires_changing = expires_with_tz != current_role_attrs.get('rolvaliduntil')
else:
expires_changing = False
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
Expand Down

0 comments on commit 23020bf

Please sign in to comment.