postgres.PgMembership: use query params in cursor.execute method (#65164)

* postgres.PgMembership: use query params in cursor.execute method

* changelog fragment
pull/43435/head
Andrey Klychkov 5 years ago committed by John R Barker
parent 2242c385b2
commit f543e72d0a

@ -0,0 +1,2 @@
bugfixes:
- postgres - use query params with cursor.execute in module_utils.postgres.PgMembership class (https://github.com/ansible/ansible/pull/65164).

@ -276,9 +276,9 @@ class PgMembership(object):
"JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid) " "JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid) "
"WHERE m.member = r.oid) " "WHERE m.member = r.oid) "
"FROM pg_catalog.pg_roles r " "FROM pg_catalog.pg_roles r "
"WHERE r.rolname = '%s'" % dst_role) "WHERE r.rolname = %(dst_role)s")
res = exec_sql(self, query, add_to_executed=False) res = exec_sql(self, query, query_params={'dst_role': dst_role}, add_to_executed=False)
membership = [] membership = []
if res: if res:
membership = res[0][0] membership = res[0][0]

Loading…
Cancel
Save