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'}
This commit is contained in:
parent
773a3becf5
commit
4f0adfb865
1 changed files with 2 additions and 2 deletions
4
lib/ansible/runner/shell_plugins/powershell.py
Normal file → Executable file
4
lib/ansible/runner/shell_plugins/powershell.py
Normal file → Executable file
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in a new issue