From bae4656bcedaaa290d87e9f836ddf28511a6405a Mon Sep 17 00:00:00 2001 From: Arto Pastinen Date: Tue, 22 Nov 2022 08:32:04 +0200 Subject: [PATCH] Correct module params for add_variables --- plugins/modules/lxc_container.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/modules/lxc_container.py b/plugins/modules/lxc_container.py index 7871f139..a9d473c7 100644 --- a/plugins/modules/lxc_container.py +++ b/plugins/modules/lxc_container.py @@ -646,7 +646,7 @@ class LxcContainerManagement(object): return any(c == container_name for c in lxc.list_containers(config_path=lxc_path)) @staticmethod - def _add_variables(variables_dict, build_command): + def _add_variables(variables_dict, build_command, values): """Return a command list with all found options. :param variables_dict: Pre-parsed optional variables used from a @@ -654,13 +654,15 @@ class LxcContainerManagement(object): :type variables_dict: ``dict`` :param build_command: Command to run. :type build_command: ``list`` + :param values: Module params + :type values: ``dict`` :returns: list of command options. :rtype: ``list`` """ for key, value in variables_dict.items(): - build_command.append(str(key)) build_command.append(str(value)) + build_command.append(values[str(key)]) return build_command def _get_vars(self, variables): @@ -777,7 +779,8 @@ class LxcContainerManagement(object): variables_dict=self._get_vars( variables=LXC_COMMAND_MAP['clone'][clone_vars] ), - build_command=build_command + build_command=build_command, + values=self.module.params ) # Load logging for the instance when creating it. @@ -830,7 +833,8 @@ class LxcContainerManagement(object): variables_dict=self._get_vars( variables=LXC_COMMAND_MAP['create']['variables'] ), - build_command=build_command + build_command=build_command, + values=self.module.params ) # Load logging for the instance when creating it. -- 2.30.2