1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Handle error in user addition in postgresql_user (#32443)

The fix adds exception handling while user add operation in
postgresql_user module.

Fixes: #29738

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-11-01 21:51:50 +05:30 committed by ansibot
parent 4fb9e54c50
commit 2b22d36b88

View file

@ -809,6 +809,10 @@ def main():
try:
changed = user_add(cursor, user, password,
role_attr_flags, encrypted, expires, conn_limit)
except psycopg2.ProgrammingError as e:
module.fail_json(msg="Unable to add user with given requirement "
"due to : %s" % to_native(e),
exception=traceback.format_exc())
except SQLParseError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())
try: