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

Merge pull request #1697 from bcoca/mint

Implements multiple interpreter overrides
This commit is contained in:
Daniel Hokka Zakrisson 2012-12-02 05:28:28 -08:00
commit d5a456fbcf
4 changed files with 10 additions and 13 deletions

View file

@ -538,20 +538,17 @@ class Runner(object):
facility = inject['ansible_syslog_facility'] facility = inject['ansible_syslog_facility']
module_data = module_data.replace('syslog.LOG_USER', "syslog.%s" % facility) module_data = module_data.replace('syslog.LOG_USER', "syslog.%s" % facility)
# use the correct python interpreter for the host
if 'ansible_python_interpreter' in inject:
interpreter = inject['ansible_python_interpreter']
module_lines = module_data.split('\n')
if '#!' and 'python' in module_lines[0]:
module_lines[0] = "#!%s" % interpreter
module_data = "\n".join(module_lines)
self._transfer_str(conn, tmp, module_name, module_data)
lines = module_data.split("\n") lines = module_data.split("\n")
shebang = None shebang = None
if lines[0].startswith("#!"): if lines[0].startswith("#!"):
shebang = lines[0] shebang = lines[0]
interpreter_config = 'ansible_%s_interpreter' % os.path.basename(shebang)
if interpreter_config in inject:
lines[0] = shebang = "#!%s" % inject[interpreter_config]
module_data = "\n".join(lines)
self._transfer_str(conn, tmp, module_name, module_data)
return (out_path, is_new_style, shebang) return (out_path, is_new_style, shebang)

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2012, Stephen Fromm <sfromm@gmail.com> # (c) 2012, Stephen Fromm <sfromm@gmail.com>

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2012, Jeroen Hoekx <jeroen@hoekx.be> # (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>