From 43a7a5a990febdc11381376f10e5a22eb271b3d4 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Thu, 19 Jun 2014 11:33:33 -0500 Subject: [PATCH] Collapse extra whitespace in encoded powershell scripts. --- lib/ansible/runner/shell_plugins/powershell.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/runner/shell_plugins/powershell.py b/lib/ansible/runner/shell_plugins/powershell.py index 5685960e8bf..2047913ad7d 100644 --- a/lib/ansible/runner/shell_plugins/powershell.py +++ b/lib/ansible/runner/shell_plugins/powershell.py @@ -46,6 +46,7 @@ def _escape(value, include_vars=False): def _encode_script(script, as_list=False): '''Convert a PowerShell script to a single base64-encoded command.''' + script = '\n'.join([x.strip() for x in script.splitlines() if x.strip()]) encoded_script = base64.b64encode(script.encode('utf-16-le')) cmd_parts = _common_args + ['-EncodedCommand', encoded_script] if as_list: