Handle LibraryError exception in postgresql_db (#65229)

* Added changes into changelogs/fragments
* Removed no longer used 'LibraryError'.

Signed-off-by: Satyajit Bulage <sbulage@redhat.com>
This commit is contained in:
Satyajit Bulage 2019-11-25 15:12:18 +05:30 committed by Abhijeet Kasurde
parent 89954e6ef5
commit 5f8ec4d46e
2 changed files with 2 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- postgresql_db - Removed exception for 'LibraryError' (https://github.com/ansible/ansible/issues/65223).

View file

@ -553,9 +553,6 @@ def main():
db_connection.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) db_connection.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = db_connection.cursor(cursor_factory=psycopg2.extras.DictCursor) 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: except TypeError as e:
if 'sslrootcert' in e.args[0]: 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)), module.fail_json(msg='Postgresql server must be at least version 8.4 to support sslrootcert. Exception: {0}'.format(to_native(e)),