voxpupuli / puppet-archive

Compressed archive file download and extraction with native types/providers for Windows and Unix

Home Page:https://forge.puppet.com/puppet/archive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows does not default to extract using powershell

MrMitch17 opened this issue · comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet:
  • Ruby:
  • Distribution:
  • Module version:

##puppet code
#Enable S3 Support for windows
class { '::archive':
aws_cli_install => true,
seven_zip_provider > 'windows' ##<< Did this to bypass cases that would default to install 7zip in init.pp:11
}

archive { "zipfile-1.2-windows-x86_64.zip":
ensure => present,
source => "http://zipfile-1.2-windows-x86_64.zip",
extract => 'true',
path => "c:/tmp/",
temp_dir => "c:/tmp/",
extract_path => "c:/Program Files/",
creates => "c:/Program Files/zipfile-1.2-windows-x86_64"
}

What are you seeing

Error: The source parameter is required when using the Windows provider.
Error: /Stage[main]/Archive/Package[7zip]/ensure: change from absent to present failed: The source parameter is required
when using the Windows provider.
Debug: Class[Archive]: Resource is being skipped, unscheduling all events
Error: /Stage[main]/Elkagent/Archive[zipfile-1.2-windows-x86_64.zip]/creates: change from archive not extracte
d to extracting in c:/Program Files/ to create c:/Program Files/zipfile-1.2-windows-x86_64 failed: 7z.exe not avail
able

What behaviour did you expect instead

When leaving the provider undefined, it should default to windows powershell if 7zip is not installed.
However, it is still requiring 7zip no matter what options are selected.

Output log

Any additional information you'd like to impart

Hi @MrMitch17, are you able to provide a patch for this? I've almost zero knowledge about puppet on windows.

This bug still exists.

The problem is that when it calls PS. It uses the System.IO.Compression.ZipFile which is loaded via .Net via this code

Starting with 5.1 PS has a native tool called Archive

Ideally, this should be reworked to use that provider first, then fall back to .Net

@paul-riley can you provide a patch for this?