From 8ef280730549c5a802982972558b1ad4e33774ab Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 27 Nov 2012 11:18:46 -0500 Subject: [PATCH 1/2] removed env as per project policy Signed-off-by: Brian Coca --- library/authorized_key | 2 +- library/group | 2 +- library/wait_for | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/authorized_key b/library/authorized_key index fbb7be8ca5..7e1df6702d 100644 --- a/library/authorized_key +++ b/library/authorized_key @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python # -*- coding: utf-8 -*- """ diff --git a/library/group b/library/group index 8a9c893500..81d7ccee6a 100644 --- a/library/group +++ b/library/group @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, Stephen Fromm diff --git a/library/wait_for b/library/wait_for index 5368a4f8a4..b41b2a3ae2 100644 --- a/library/wait_for +++ b/library/wait_for @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2012, Jeroen Hoekx From 2f2bd87b06a374a188eb52348bb50a320524e0b3 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 27 Nov 2012 11:18:57 -0500 Subject: [PATCH 2/2] multiple _interpreter overrides with ansible__interpreter variables, not just for python anymore Signed-off-by: Brian Coca --- lib/ansible/runner/__init__.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 7837e691a9..af396ca87f 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -545,20 +545,17 @@ class Runner(object): facility = inject['ansible_syslog_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") shebang = None if lines[0].startswith("#!"): 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)