Преглед изворни кода

Fix winrm file writing failing on Powershell 4.0

Daniel Vincze пре 5 година
родитељ
комит
190c47e755
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      coriolis/utils.py

+ 1 - 1
coriolis/utils.py

@@ -276,7 +276,7 @@ def write_winrm_file(conn, remote_path, content, overwrite=True):
             data = data.encode()
             data = data.encode()
         asb64 = base64.b64encode(data).decode()
         asb64 = base64.b64encode(data).decode()
         cmd = ("$ErrorActionPreference = 'Stop';"
         cmd = ("$ErrorActionPreference = 'Stop';"
-               "$x = [System.IO.FileStream]::new(\"%s\", "
+               "$x = New-Object System.IO.FileStream(\"%s\", "
                "[System.IO.FileMode]::Append); $bytes = "
                "[System.IO.FileMode]::Append); $bytes = "
                "[Convert]::FromBase64String('%s'); $x.Write($bytes, "
                "[Convert]::FromBase64String('%s'); $x.Write($bytes, "
                "0, $bytes.Length); $x.Close()") % (
                "0, $bytes.Length); $x.Close()") % (