diff --git a/changelogs/fragments/12106-fix-lxc-create_script.yml b/changelogs/fragments/12106-fix-lxc-create_script.yml new file mode 100644 index 0000000000..93fcf082d3 --- /dev/null +++ b/changelogs/fragments/12106-fix-lxc-create_script.yml @@ -0,0 +1,2 @@ +bugfixes: + - lxc_container - fix ``create_script`` to accept a single tuple argument, resolving a ``TypeError`` that silently prevented ``container_command`` from being executed (https://github.com/ansible-collections/community.general/issues/11360, https://github.com/ansible-collections/community.general/pull/12106). diff --git a/plugins/module_utils/_lxc.py b/plugins/module_utils/_lxc.py index 8db257c83a..577dd99db1 100644 --- a/plugins/module_utils/_lxc.py +++ b/plugins/module_utils/_lxc.py @@ -30,17 +30,20 @@ popd """ -def create_script(command: str, module: AnsibleModule) -> None: +def create_script(arg_tuple: tuple[str, AnsibleModule]) -> None: """Write out a script onto a target. This method should be backward compatible with Python when executing from within the container. - :param command: command to run, this can be a script and can use spacing - with newlines as separation. - :param module: AnsibleModule to run commands with. + :param arg_tuple: a tuple of (command, module) where command is the command + to run (this can be a script and can use spacing with + newlines as separation) and module is the AnsibleModule + to run commands with. """ + command, module = arg_tuple + script_file = "" try: f = tempfile.NamedTemporaryFile(prefix="lxc-attach-script", delete=False, mode="wb")