Fix user_alter in postgresql_user

This commit is contained in:
Devin Christensen 2014-11-25 12:04:47 -07:00 committed by Matt Clay
parent ff7a9eb625
commit b2829cf6b9

View file

@ -218,7 +218,7 @@ def user_alter(cursor, module, user, password, role_attr_flags, encrypted, expir
# Grab current role attributes.
current_role_attrs = cursor.fetchone()
alter = ['ALTER USER "%(user)s"' % {"user": pg_quote_identifier(user, 'role')}]
alter = ['ALTER USER %(user)s' % {"user": pg_quote_identifier(user, 'role')}]
if password is not None:
alter.append("WITH %(crypt)s" % {"crypt": encrypted})
alter.append("PASSWORD %(password)s")
@ -229,7 +229,7 @@ def user_alter(cursor, module, user, password, role_attr_flags, encrypted, expir
alter.append("VALID UNTIL %(expires)s")
try:
cursor.execute(alter, query_password_data)
cursor.execute(' '.join(alter), query_password_data)
except psycopg2.InternalError, e:
if e.pgcode == '25006':
# Handle errors due to read-only transactions indicated by pgcode 25006