From 2398ca917f7d3e1cd71d40bc53b2b03533306175 Mon Sep 17 00:00:00 2001 From: nitzmahone Date: Mon, 11 Jul 2016 11:51:28 -0700 Subject: [PATCH] tkuratomi bugfix for BOMs in powershell modules fixes #15998 (cherry picked from commit 31e963dd2a499a9c6eca8c5f30b480a9b867f84b) --- lib/ansible/executor/module_common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py index c057d670e51..f4abafe3fcb 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -668,6 +668,12 @@ def _find_snippet_imports(module_name, module_data, module_path, module_args, ta module_args_json = to_bytes(json.dumps(module_args)) module_data = module_data.replace(REPLACER_JSONARGS, module_args_json) + # Powershell/winrm don't actually make use of shebang so we can + # safely set this here. If we let the fallback code handle this + # it can fail in the presence of the UTF8 BOM commonly added by + # Windows text editors + shebang = u'#!powershell' + # Sanity check from 1.x days. This is currently useless as we only # get here if we are going to substitute powershell.ps1 into the # module anyway. Leaving it for when/if we add other powershell