puppet-archive icon indicating copy to clipboard operation
puppet-archive copied to clipboard

Windows does not default to extract using powershell

Open MrMitch17 opened this issue 6 years ago • 1 comments
trafficstars

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

MrMitch17 avatar Feb 07 '19 17:02 MrMitch17

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

bastelfreak avatar Feb 09 '19 23:02 bastelfreak

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 avatar May 21 '24 15:05 paul-riley

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

bastelfreak avatar May 25 '24 16:05 bastelfreak