-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File type resource should support Etag header as source for metadata #9319
Comments
There's a related archived ticket in https://puppet.atlassian.net/browse/PUP-9971 Just a clarification, f you specify the desired checksum type and value in the manifest, then the need for file { '/tmp/file.txt':
ensure => file,
source => 'http://httpstat.us/200',
checksum => 'sha256',
checksum_value => 'f9bafc82ba5f8fb02b25020d66f396860604f496ca919480147fa525cb505d88',
} But if you want the latest file from the server without having to make changes to the manifest, then |
Thanks for your reply. The disadvantage of using that method is that you have to keep track in your code of the checksum value every time the file changes, it would be great if Puppet could handle that automatically. |
@joshcooper why would you need to maintain state? Puppet would just check the value of the |
Migrated issue to PUP-12033 |
@kenyon with the other headers that @cpiment cited--all of the various checksums--we don't have to maintain state because we can independently calculate those checksums and compare with what the source is offering. An
We don't know for sure what an |
@mhashizume ah yeah duh, thanks. I suppose the |
Hi @kenyon, not really. An |
For this to work, the agent would need to store the
It would need to extract the
And it would need to compare the new This happens in the DataSync module which is mixed into the puppet/lib/puppet/type/file/data_sync.rb Line 26 in fb44fd9
It might be possible to store the ETag metadata in |
I was thinking that puppet/archive might be a good place to implement this. Here is what appears to be an identical request, which, funnily, I closed: voxpupuli/puppet-archive#363 Here is a possible implementation: voxpupuli/puppet-archive#281 (comment) |
It seems that puppet/archive handles compressed files, but implementing it in the File resource can solve this for any kind of files.
I think this implementation works assuming that the S3 bucket |
Hi @joshcooper, is there any news on this issue or do you have any plan for this to be implemented? Thanks in advance for your help |
FYI, I just hit this with apt::keyring, while implementing repo install method in the puppet-caddy module. I don't want to pin the gpg key checksum, because I don't want to maintain it in the module (also puppetlabs/puppetlabs-apt#1196 is still open). Any chance to have this implemented soon? Or shall I start a pull request? :) |
Use Case
When sourcing files from an http(s) source, in order to check if the file is already present Puppet, searches for these headers:
X-Checksum-Sha256
X-Checksum-Sha1
X-Checksum-Md5
Content-MD5
Last-Modified
Some servers (such as Gitlab) do not provide any of these headers, but they do provide an
Etag
header, which indicates the version of the resource that is going to be served.Describe the Solution You Would Like
Modify the code responsible for retrieving the metadata from http(s) resources (I think is this) to take into account the
Etag
header with more priority thanLast-Modified
since it seems thatLast-Modified
should be considered a fallback when there is noEtag
(as stated in MDN)Describe Alternatives You've Considered
Use other resource to download files, but I have not found any module in the forge that uses
Etag
as metadata of the version of the file.Additional Context
N/A
The text was updated successfully, but these errors were encountered: