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:
parent
4fb9e54c50
commit
2b22d36b88
1 changed files with 4 additions and 0 deletions
|
@ -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…
Reference in a new issue