Jelajahi Sumber

Fix winrm file writing failing on Powershell 4.0

Daniel Vincze 5 tahun lalu
induk
melakukan
190c47e755
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  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()") % (