Skip to content

Commit

Permalink
Fix: add call to ensure required libraries in get_conn_params
Browse files Browse the repository at this point in the history
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 ansible-collections#252
  • Loading branch information
jchancojr committed May 2, 2022
1 parent ae10d39 commit 3c24028
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/module_utils/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 3c24028

Please sign in to comment.