diff options
Diffstat (limited to 'lib/ansible/module_utils/common/respawn.py')
-rw-r--r-- | lib/ansible/module_utils/common/respawn.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ansible/module_utils/common/respawn.py b/lib/ansible/module_utils/common/respawn.py index 3e209ca0..3bc526af 100644 --- a/lib/ansible/module_utils/common/respawn.py +++ b/lib/ansible/module_utils/common/respawn.py @@ -8,7 +8,7 @@ import os import subprocess import sys -from ansible.module_utils.common.text.converters import to_bytes +from ansible.module_utils.common.text.converters import to_bytes, to_native def has_respawned(): @@ -79,9 +79,10 @@ def _create_payload(): import runpy import sys -module_fqn = {module_fqn!r} -modlib_path = {modlib_path!r} -smuggled_args = {smuggled_args!r} +module_fqn = '{module_fqn}' +modlib_path = '{modlib_path}' +smuggled_args = b"""{smuggled_args}""".strip() + if __name__ == '__main__': sys.path.insert(0, modlib_path) @@ -92,6 +93,6 @@ if __name__ == '__main__': runpy.run_module(module_fqn, init_globals=dict(_respawned=True), run_name='__main__', alter_sys=True) ''' - respawn_code = respawn_code_template.format(module_fqn=module_fqn, modlib_path=modlib_path, smuggled_args=smuggled_args.strip()) + respawn_code = respawn_code_template.format(module_fqn=module_fqn, modlib_path=modlib_path, smuggled_args=to_native(smuggled_args)) return respawn_code |