mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-11 02:25:36 +00:00
[PR #12106/50046965 backport][stable-12] lxc_container: Fix create_script in plugins/module_utils/_lxc.py (#12110)
lxc_container: Fix create_script in plugins/module_utils/_lxc.py (#12106)
* Fix create_script in plugins/module_utils/_lxc.py
* Added changelog fragment
* Apply suggestions from code review - updated typing
* Apply suggestion from code review - fixed docstring argument name
* Apply suggestion from code review
* Update plugins/module_utils/_lxc.py
---------
(cherry picked from commit 50046965c9)
Co-authored-by: usbpc <3638901+usbpc@users.noreply.github.com>
Co-authored-by: Kevin Holm <kevin@holm.dev>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
b759173038
commit
cd057ddcdb
2 changed files with 9 additions and 4 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue