From 1f7b0fee0a5e1ed9e5fff7d0a08b71033f199006 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 24 Aug 2015 19:06:40 -0700 Subject: [PATCH] Fixes #12076 --- lib/ansible/executor/module_common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py index 09fdaa46d85..11ee68e7b6d 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -188,9 +188,11 @@ def modify_module(module_path, module_args, task_vars=dict(), strip_comments=Fal interpreter = to_bytes(task_vars[interpreter_config], errors='strict') lines[0] = shebang = b"#!{0} {1}".format(interpreter, b" ".join(args[1:])) - lines.insert(1, ENCODING_STRING) + if interpreter.startswith('python'): + lines.insert(1, ENCODING_STRING) else: - lines.insert(0, ENCODING_STRING) + # No shebang, assume a binary module? + pass module_data = b"\n".join(lines)