From 562ff7efb7e6c69bfaa4c534693c70425cdc1e6c Mon Sep 17 00:00:00 2001 From: topperharly Date: Wed, 10 Feb 2021 22:07:27 +0100 Subject: [PATCH] only set param features when variable is not empty (#1763) * only set param features when variable is not empty * Apply suggestions from code review Co-authored-by: Felix Fontein Co-authored-by: Topper Harly Co-authored-by: Felix Fontein --- .../816-only-invocate-feature-when-variable-is-set.yml | 2 ++ plugins/modules/cloud/misc/proxmox.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/816-only-invocate-feature-when-variable-is-set.yml diff --git a/changelogs/fragments/816-only-invocate-feature-when-variable-is-set.yml b/changelogs/fragments/816-only-invocate-feature-when-variable-is-set.yml new file mode 100644 index 0000000000..7d48c77298 --- /dev/null +++ b/changelogs/fragments/816-only-invocate-feature-when-variable-is-set.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox lxc - only add the features flag when module parameter ``features`` is set. Before an empty string was send to proxmox in case the parameter was not used, which required to use ``root@pam`` for module execution (https://github.com/ansible-collections/community.general/pull/1763). diff --git a/plugins/modules/cloud/misc/proxmox.py b/plugins/modules/cloud/misc/proxmox.py index d3cfda3d92..c4cfd9b5e7 100644 --- a/plugins/modules/cloud/misc/proxmox.py +++ b/plugins/modules/cloud/misc/proxmox.py @@ -622,7 +622,7 @@ def main(): searchdomain=module.params['searchdomain'], force=int(module.params['force']), pubkey=module.params['pubkey'], - features=",".join(module.params['features'] or []), + features=",".join(module.params['features']) if module.params['features'] is not None else None, unprivileged=int(module.params['unprivileged']), description=module.params['description'], hookscript=module.params['hookscript'])