From 3c24028dc80800d9f5896385d02742f93edb492e Mon Sep 17 00:00:00 2001 From: Jim Chanco Jr Date: Mon, 2 May 2022 10:52:57 -0400 Subject: [PATCH] Fix: add call to ensure required libraries in get_conn_params added `ensure_required_libs(module)` to `get_conn_params` to ensure a meaningful error is thrown when psycopg2 is not installed. Without this change the error was; `AttributeError: 'NoneType' object has no attribute '__version__'`. Fixes #252 --- plugins/module_utils/postgres.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/module_utils/postgres.py b/plugins/module_utils/postgres.py index 508a05a9..83772d32 100644 --- a/plugins/module_utils/postgres.py +++ b/plugins/module_utils/postgres.py @@ -177,6 +177,9 @@ def get_conn_params(module, params_dict, warn_db_default=True): Kwargs: warn_db_default (bool) -- warn that the default DB is used (default True) """ + + ensure_required_libs(module) + # To use defaults values, keyword arguments must be absent, so # check which values are empty and don't include in the return dictionary params_map = {