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

Make it possible to update a file without supplying a checksum-file

rogermartensson opened this issue · comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: Puppet 5.x
  • Ruby: Puppet supplied from package
  • Distribution: Ubuntu
  • Module version: 3.2.0

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

archive { '/tmp/test-file.txt':
  source         => '<a http/s-url to a text file>',
  allow_insecure => true,
}

allow_insecure was needed in my local test environment. Just added for consistency.

What are you seeing

If file does not exist, file is downloaded. If file already exist nothing is downloaded even if the source file is newer/changed.

What behaviour did you expect instead

The changed file to be downloaded.

Output log

Any additional information you'd like to impart

This works if I use a checksum but it would be nice to be able to download the updated file when checksum_type is set to none. There might be situations where a checksum isn't easily created at the source.

What would be the trigger you expect? Based on what criteria to identify if the file has changed?

The idea of the checksum is to have a versioning defined for the file. If the file doesn't have a checksum, do you imply that archive should somehow know what was the original checksum of the file when it ran (e.g. 30min ago), identify that the file wasn't changed on the disk, and if it did, then re-download the file, or to re-download the file if the version has changed remotely?

In either case, you are implying that archive should store a state of the file (checksum) itself, internally. I'm not aware if puppet can do that for anything.

You can achieve the same thing if you are able to create a custom fact with the checksum ... you would still need to know the checksum of your file you download.

Valid points.
It probably is doable if there was way to compare dates since browsers have a mechanism for deciding if a file needs to be updated. But it's probably more work to implement it than the benefit it gives.

Maybe add some documentation about using no checksum on URLs won't update the file. For the next person, like me, that thinks it would update the file based on date. Or disallow http/https-files download without checksum. (maybe must use a force => true if needed)

Thanks again. This can be closed if you want.

The built in file resource can do this. Also, usually for this use case, packaging your files with deb/rpm is a better solution.