voxpupuli/puppet-archive

ZIP does not extract if directory does not exist

Opened this issue · 0 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.4.3
  • Ruby: 2.5.3
  • Distribution: Windows Server 2016
  • Module version: 3.2.1

How to reproduce (e.g Puppet code you use)

$sql_install_zip = "C:\\temp\\sql_2016.zip"
$sql_install_extract_dir = "C:\\temp\\sql_2016"
archive::nexus { $sql_install_zip:
    gav          => $installer['gav'],
    repository   => $installer['repository'],
    packaging    => $installer['packaging'],
    mode         => '670',
    extract      => true,
    extract_path => $sql_install_extract_dir,
  }

What are you seeing

The Archive (and internally File resource) are marked as present and successful, but the ZIP file is never extracted. Running in debug mode, the debug statement below is never output:
Puppet.debug("Archive extracting #{@file} in #{path}: #{cmd}")

No SystemCallError exception is being thrown

What behavior did you expect instead

One of two options:

  • SystemCallError Ruby exception should be thrown if the directory doesn't exist
  • Extract function should not rely on the extract directory existing. In the case of 7-zip, it will create the extract directory for you.

Output log

Any additional information you'd like to impart

Ruby isn't my strong suit, but looking at the code I figured it would throw a SystemCallError exception.