From f6f8ce07e9e05064574dd4785ee396d66d8ed2af Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 5 Dec 2022 13:42:25 +0000 Subject: [PATCH] lxc_container: fix lxc argument when executing lxc command lxc_container fails when executing the lxc command (e.g. when creating a new container) because PR#5358 broke the module argument parsing. The resulting argument dict contained only the module argument name and the argument flag but not the value. E.g. ``` - lxc_container: template: debian ``` would result in lxc command arguments `lxc template --template` instead of `lxc --template debian`. Fixes: 6f88426cf1dc ("lxc_container: minor refactor (#5358)") Fixes #5578 Signed-off-by: Alexander Couzens --- changelogs/fragments/5659-fix-lxc_container-command.yml | 2 ++ plugins/modules/lxc_container.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5659-fix-lxc_container-command.yml diff --git a/changelogs/fragments/5659-fix-lxc_container-command.yml b/changelogs/fragments/5659-fix-lxc_container-command.yml new file mode 100644 index 00000000000..450d889808d --- /dev/null +++ b/changelogs/fragments/5659-fix-lxc_container-command.yml @@ -0,0 +1,2 @@ +bugfixes: + - lxc_container - fix the arguments of the lxc command which broke the creation and cloning of containers (https://github.com/ansible-collections/community.general/issues/5578). diff --git a/plugins/modules/lxc_container.py b/plugins/modules/lxc_container.py index 7871f139720..9fe27b8d816 100644 --- a/plugins/modules/lxc_container.py +++ b/plugins/modules/lxc_container.py @@ -677,7 +677,7 @@ def _get_vars(self, variables): false_values = BOOLEANS_FALSE.union([None, '']) result = dict( - (k, v) + (v, self.module.params[k]) for k, v in variables.items() if self.module.params[k] not in false_values )