From 15799b2dd51b82d32e98f6291959a94cf05eda15 Mon Sep 17 00:00:00 2001 From: Mike Graves Date: Thu, 24 Jun 2021 12:15:27 -0400 Subject: [PATCH] Check that auth value is not None (#151) * Check that auth value is not None The previous check for truth prevented the verify_ssl param from being set to false, thus forcing ssl verfication in every case. * Add changelog fragment * Fix linting --- changelogs/fragments/151-check-auth-params-for-existence.yaml | 3 +++ plugins/module_utils/common.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/151-check-auth-params-for-existence.yaml diff --git a/changelogs/fragments/151-check-auth-params-for-existence.yaml b/changelogs/fragments/151-check-auth-params-for-existence.yaml new file mode 100644 index 0000000000..d251f08f56 --- /dev/null +++ b/changelogs/fragments/151-check-auth-params-for-existence.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - check auth params for existence, not whether they are true (https://github.com/ansible-collections/kubernetes.core/pull/151). diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index e3a48cca03..48e55ec044 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -124,7 +124,7 @@ def _raise_or_fail(exc, msg): # If authorization variables aren't defined, look for them in environment variables for true_name, arg_name in AUTH_ARG_MAP.items(): - if module and module.params.get(arg_name): + if module and module.params.get(arg_name) is not None: auth[true_name] = module.params.get(arg_name) elif arg_name in kwargs and kwargs.get(arg_name) is not None: auth[true_name] = kwargs.get(arg_name)