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
59 stars 176 forks source link

Example in README doesn't make sense. #469

Closed pillarsdotnet closed 2 years ago

pillarsdotnet commented 2 years ago

The following code in lines 228-238 of README.md has the same $install_path path listed for both the creates and require attributes:

archive { $filename:
  path          => "/tmp/${filename}",
  source        => "http://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.0.M3/bin/apache-tomcat-9.0.0.M3.zip",
  checksum      => 'f2aaf16f5e421b97513c502c03c117fab6569076',
  checksum_type => 'sha1',
  extract       => true,
  extract_path  => '/opt',
  creates       => $install_path,
  cleanup       => 'true',
  require       => File[$install_path],
}

If File[$install_path] is declared elsewhere and evaluated successfully, the creates attribute should prevent the archive from being downloaded, according to line 492:

  • creates: if file/directory exists, will not download/extract archive.

If File[$install_path] is not declared elsewhere, catalog compilation should fail because of the missing dependency:

If one of the resources in a relationship is never declared, compilation fails with one of the following errors:

  • Could not find dependency <OTHER RESOURCE> for <RESOURCE>
  • Could not find resource <OTHER RESOURCE> for relationship on <RESOURCE>

If File[$install_path] is declared elsewhere but fails, the archive resource should be skipped:

If Puppet fails to apply the prior resource in a relationship, it skips the subsequent resource and log the following messages: notice: <RESOURCE>: Dependency <OTHER RESOURCE> has failures: true warning: <RESOURCE>: Skipping because of failed dependencies It then continues to apply any unrelated resources. Any resources that depend on the skipped resource are also skipped. This helps prevent an inconsistent system state, rather than attempting to apply a resource that might have broken prerequisites.

The example as written doesn't appear to make sense and should be removed or corrected.