Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ in development
Fixed
~~~~~

* Fix issue of WinRM parameter passing fails for larger scripts.#5538

Contributed by @ashwini-orchestral

* Fix Type error for ``time_diff`` critera comparison. convert the timediff value as float to match
``timedelta.total_seconds()`` return. #5462

Expand Down
4 changes: 2 additions & 2 deletions contrib/runners/winrm_runner/tests/unit/test_winrm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ def test__run_ps_script(self, mock_tmp_script, mock_run_ps):
mock_tmp_script.assert_called_with(
"[System.IO.Path]::GetTempPath()", "$PSVersionTable"
)
mock_run_ps.assert_called_with("& {C:\\tmpscript.ps1}")
mock_run_ps.assert_called_with("C:\\tmpscript.ps1")

@mock.patch("winrm_runner.winrm_base.WinRmBaseRunner._run_ps")
@mock.patch("winrm_runner.winrm_base.WinRmBaseRunner._tmp_script")
Expand All @@ -923,7 +923,7 @@ def test__run_ps_script_with_params(self, mock_tmp_script, mock_run_ps):
mock_tmp_script.assert_called_with(
"[System.IO.Path]::GetTempPath()", "Get-ChildItem"
)
mock_run_ps.assert_called_with("& {C:\\tmpscript.ps1} -param1 value1 arg1")
mock_run_ps.assert_called_with("C:\\tmpscript.ps1 -param1 value1 arg1")

@mock.patch("winrm_runner.winrm_base.WinRmBaseRunner._run_ps")
def test__run_ps_or_raise(self, mock_run_ps):
Expand Down
4 changes: 2 additions & 2 deletions contrib/runners/winrm_runner/winrm_runner/winrm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,9 @@ def _run_ps_script(self, script, params=None):
# handle deletion of the temporary file on exit of the with block
with self._tmp_script(tmp_dir, script) as tmp_script:
# the following wraps the script (from the file) in a script block ( {} )
# executes it, passing in the parameters built above
# executes it, passing in the parameters built above.
# https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/console/powershell.exe-command-line-help
ps = "& {%s}" % (tmp_script)
ps = tmp_script
if params:
ps += " " + params
return self._run_ps(ps)
Expand Down