From b2829cf6b9fb399cabd3fc9b9aa88ca84aac743b Mon Sep 17 00:00:00 2001 From: Devin Christensen Date: Tue, 25 Nov 2014 12:04:47 -0700 Subject: [PATCH] Fix user_alter in postgresql_user --- lib/ansible/modules/database/postgresql/postgresql_user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/database/postgresql/postgresql_user.py b/lib/ansible/modules/database/postgresql/postgresql_user.py index c17b0a9a738..8f2248ebb16 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_user.py +++ b/lib/ansible/modules/database/postgresql/postgresql_user.py @@ -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