voxpupuli / puppet-archive

Compressed archive file download and extraction with native types/providers for Windows and Unix
https://forge.puppet.com/puppet/archive
Apache License 2.0
60 stars 178 forks source link

Changing back and forth between different version of an archive does not re-extract #477

Open dhs-rec opened 1 year ago

dhs-rec commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

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

  archive { 'some_pkg':
    path          => $some_pkg,
    source        => $some_pkg_remote,
    checksum      => $checksum,
    checksum_type => 'sha256',
    cleanup       => true,
    extract       => true,
    extract_path  => $tools_dir::tools_dir,
    require       => [
      Class['sevenzip'],
      Class['tools_dir'],
    ],
  }

What are you seeing

Rolling out first version of archive some_pkg works fine Rolling out second version (which has different file name AND checksum) replaces first version, as expected Trying to roll out first version again (because second version has a bug) does nothing

Also, the local copies of the archives, under path are not removed, despite cleanup => true.

What behaviour did you expect instead

First version should replace second version, no local copy should exist after Puppet agent run

Output log

Well, no action, no log

Additional information

The only way to achieve a rollback to the first version is to write a trigger file containing the checksum, have an exec, subscribed to that file, which removes the extracted directory under extract_path and in turn let archive require that exec

dhs-rec commented 1 year ago

BTW: The problem could be easily solved by comparing the archives ToC with the actual content of (the directory tree under) extract_path (this is also what Salt does).