reidmv / puppet-module-unzip

Unzip defined type for Windows
0 stars 1 forks source link

unzip fails to unzip, silently fails #5

Open biscuitWizard opened 8 years ago

biscuitWizard commented 8 years ago

Using unzip in our project.

unzip { "unzip ${zipSaveAbsolutePath}": source => $zipSaveAbsolutePath, creates => $extractionVerificationFile, destination => $extractionFolder, require => Exec["create ${extractionFolder}"] }

sample parameters: $zipSaveAbsolutePath: c:\foo.zip $extractionVerificationFile: c:\apps\bar\zed.exe $extractionFolder: C:\apps\bar

File foo.zip exists and contains zed.exe, and the "unzip c:\foo.zip" process reports a successful execution, the extraction folder is empty.

/////

Would expect that because the folder is empty, unzip would extract foo.zip and zed.exe would be inside the folder.

jingl3s commented 4 years ago

I know this issue was raised many year ago but as I ma stucked with that version. I have a workaround to patch the init.pp of unzip in order to replace current working with

command  => "Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('$source', '$dest')",
#returns   => 0,

As you going to see returns is ignored as in case of output file exists it fails with an exception.

With more recent version of powershell the unzip function could manage more things