summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd-Jan Barnas <gbarnas@cisco.com>2015-08-07 09:50:04 -0400
committerArd-Jan Barnas <gbarnas@cisco.com>2015-08-07 09:50:04 -0400
commit4f0adfb865402265e16b25ab13471c4c038b67bd (patch)
tree46edccd2bbb866f6c762821634038af2295a638c
parent773a3becf52781220eb0608dbc15a4ed40b22c59 (diff)
downloadansible-4f0adfb865402265e16b25ab13471c4c038b67bd.tar.gz
Fix powershell splatting leaving 'ExecutionPolicy Unrestricted' intact'
Changed powershell.py to fix powershell splatting. To make sure the ExectutionPolicy stays working, added 'ExecutionPolicy Unrestricted' to _common-args. This restores support for: myscript.ps1 @{'Key'='Value';'Another'='Value'}
-rwxr-xr-x[-rw-r--r--]lib/ansible/runner/shell_plugins/powershell.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ansible/runner/shell_plugins/powershell.py b/lib/ansible/runner/shell_plugins/powershell.py
index 850b380edd..a5709a012c 100644..100755
--- a/lib/ansible/runner/shell_plugins/powershell.py
+++ b/lib/ansible/runner/shell_plugins/powershell.py
@@ -22,7 +22,7 @@ import random
import shlex
import time
-_common_args = ['PowerShell', '-NoProfile', '-NonInteractive']
+_common_args = ['PowerShell', '-NoProfile', '-NonInteractive','-ExecutionPolicy', 'Unrestricted']
# Primarily for testing, allow explicitly specifying PowerShell version via
# an environment variable.
@@ -57,7 +57,7 @@ def _build_file_cmd(cmd_parts, quote_args=True):
'''Build command line to run a file, given list of file name plus args.'''
if quote_args:
cmd_parts = ['"%s"' % x for x in cmd_parts]
- return ' '.join(_common_args + ['-ExecutionPolicy', 'Unrestricted', '-File'] + cmd_parts)
+ return ' '.join(['&'] + cmd_parts)
class ShellModule(object):