mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Move strip to powershell block, add -NoProfile
This commit is contained in:
parent
9378b22d80
commit
6586050736
1 changed files with 6 additions and 2 deletions
|
@ -280,6 +280,10 @@ def _run(cmd,
|
|||
raise CommandExecutionError('VT not available on windows')
|
||||
|
||||
if shell.lower().strip() == 'powershell':
|
||||
# Strip whitespace
|
||||
if isinstance(cmd, six.string_types):
|
||||
cmd = cmd.strip()
|
||||
|
||||
# If we were called by script(), then fakeout the Windows
|
||||
# shell to run a Powershell script.
|
||||
# Else just run a Powershell command.
|
||||
|
@ -289,9 +293,9 @@ def _run(cmd,
|
|||
# The last item in the list [-1] is the current method.
|
||||
# The third item[2] in each tuple is the name of that method.
|
||||
if stack[-2][2] == 'script':
|
||||
cmd = 'Powershell -NonInteractive -ExecutionPolicy Bypass -File ' + cmd
|
||||
cmd = 'Powershell -NonInteractive -NoProfile -ExecutionPolicy Bypass -File ' + cmd
|
||||
else:
|
||||
cmd = 'Powershell -NonInteractive "{0}"'.format(cmd.replace('"', '\\"'))
|
||||
cmd = 'Powershell -NonInteractive -NoProfile "{0}"'.format(cmd.replace('"', '\\"'))
|
||||
|
||||
# munge the cmd and cwd through the template
|
||||
(cmd, cwd) = _render_cmd(cmd, cwd, template, saltenv, pillarenv, pillar_override)
|
||||
|
|
Loading…
Add table
Reference in a new issue