1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ignore arguments when checking for interpreter, and re-add before use

This commit is contained in:
Daniel Hokka Zakrisson 2012-11-27 21:58:32 +01:00
parent d5a456fbcf
commit e54b4b1c9a

View file

@ -28,6 +28,7 @@ import collections
import socket
import base64
import sys
import shlex
import ansible.constants as C
import ansible.inventory
@ -542,10 +543,12 @@ class Runner(object):
shebang = None
if lines[0].startswith("#!"):
shebang = lines[0]
interpreter_config = 'ansible_%s_interpreter' % os.path.basename(shebang)
args = shlex.split(str(shebang[2:]))
interpreter = args[0]
interpreter_config = 'ansible_%s_interpreter' % os.path.basename(interpreter)
if interpreter_config in inject:
lines[0] = shebang = "#!%s" % inject[interpreter_config]
lines[0] = shebang = "#!%s %s" % (inject[interpreter_config], " ".join(args[1:]))
module_data = "\n".join(lines)
self._transfer_str(conn, tmp, module_name, module_data)