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>
pull/32450/head
Abhijeet Kasurde 7 years ago committed by ansibot
parent 4fb9e54c50
commit 2b22d36b88

@ -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:

Loading…
Cancel
Save