diff --git a/changelogs/fragments/4733-redis-fail.yml b/changelogs/fragments/4733-redis-fail.yml new file mode 100644 index 0000000000..f8a6e14d9a --- /dev/null +++ b/changelogs/fragments/4733-redis-fail.yml @@ -0,0 +1,2 @@ +bugfixes: + - "redis* modules - fix call to ``module.fail_json`` when failing because of missing Python libraries (https://github.com/ansible-collections/community.general/pull/4733)." diff --git a/plugins/module_utils/redis.py b/plugins/module_utils/redis.py index de5c8c7fc3..8f035614f0 100644 --- a/plugins/module_utils/redis.py +++ b/plugins/module_utils/redis.py @@ -37,7 +37,7 @@ def fail_imports(module, needs_certifi=True): errors.append(missing_required_lib('certifi')) traceback.append(CERTIFI_IMPORT_ERROR) if errors: - module.fail_json(errors=errors, traceback='\n'.join(traceback)) + module.fail_json(msg='\n'.join(errors), traceback='\n'.join(traceback)) def redis_auth_argument_spec(tls_default=True):