From 5f8ec4d46e1fec49eca5c2f351141ed5da6d259e Mon Sep 17 00:00:00 2001 From: Satyajit Bulage Date: Mon, 25 Nov 2019 15:12:18 +0530 Subject: [PATCH] Handle LibraryError exception in postgresql_db (#65229) * Added changes into changelogs/fragments * Removed no longer used 'LibraryError'. Signed-off-by: Satyajit Bulage --- changelogs/fragments/65223-postgresql_db-exception-added.yml | 2 ++ lib/ansible/modules/database/postgresql/postgresql_db.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/65223-postgresql_db-exception-added.yml diff --git a/changelogs/fragments/65223-postgresql_db-exception-added.yml b/changelogs/fragments/65223-postgresql_db-exception-added.yml new file mode 100644 index 00000000000..51656b12808 --- /dev/null +++ b/changelogs/fragments/65223-postgresql_db-exception-added.yml @@ -0,0 +1,2 @@ +bugfixes: + - postgresql_db - Removed exception for 'LibraryError' (https://github.com/ansible/ansible/issues/65223). diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index cdbb8443b65..2fdfe7bb1a7 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -553,9 +553,6 @@ def main(): db_connection.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) cursor = db_connection.cursor(cursor_factory=psycopg2.extras.DictCursor) - except pgutils.LibraryError as e: - module.fail_json(msg="unable to connect to database: {0}".format(to_native(e)), exception=traceback.format_exc()) - except TypeError as e: if 'sslrootcert' in e.args[0]: module.fail_json(msg='Postgresql server must be at least version 8.4 to support sslrootcert. Exception: {0}'.format(to_native(e)),