Skip to content
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

artifact_file try to verify the checksum when it's not provided in the recipe #149

Open
evangael opened this issue Aug 25, 2014 · 4 comments

Comments

@evangael
Copy link

chef-client : 11.4.4
Artifact cookbook : 1.11.2

When I try to converge one of my node I get an error about an invalid checksum for a file. The thing is, I'm not using nexus nor am I providing a checksum. The file is still in the s3 bucket and didn't change.

Part of the recipe handling that :

artifact_file "/usr/local/inversoft/config/#{node['cleanspeak_gs']['license_id']}.license" do
  location "s3://s3.amazonaws.com/#{node['cleanspeak_gs']['s3_bucket_license_file']}/#{node['cleanspeak_gs']['license_id']}.license"
  action :create
end

And the error in the chef-client run :

================================================================================
Error executing action `create` on resource 'artifact_file[/usr/local/inversoft/config/cl.license]'
================================================================================


Chef::Artifact::ArtifactChecksumError
-------------------------------------
[artifact] Downloaded file checksum does not match the provided checksum. Your download may be corrupted or your checksum may not be correct.


Cookbook Trace:
---------------
/var/chef/cache/cookbooks/artifact/providers/file.rb:80:in `rescue in block in class_from_file'
/var/chef/cache/cookbooks/artifact/providers/file.rb:53:in `block in class_from_file'


Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/cleanspeak_gs/recipes/default.rb

 33: artifact_file"/usr/local/inversoft/config/#{node['cleanspeak_gs']['license_id']}.license" do
 34:   location "s3://s3.amazonaws.com/#{node['cleanspeak_gs']['s3_bucket_license_file']}/#{node['cleanspeak_gs']['license_id']}.license"
 35:   action :create
 36: end
 37:



Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/cleanspeak_gs/recipes/default.rb:33:in `from_file'

artifact_file("/usr/local/inversoft/config/cl.license") do
  action [:create]
  retries 0
  retry_delay 2
  cookbook_name "cleanspeak_gs"
  recipe_name "default"
  location "s3://s3.amazonaws.com/s3-bucket/cl.license"
  download_retries 1
end
@KAllan357
Copy link
Contributor

Can you verify the contents of your file_cache_path/artifact_file? There could be some edge case here that I am unaware of.

@evangael
Copy link
Author

Hello KAllan357, there was some files theres with what I expect would be checksum. There was one for the licence file. Deleting the content of this dir fixed this problem.

But, this file, in the recipe never included any checksum checking.

@KAllan357
Copy link
Contributor

@evangael the original intent behind some of the code in the artifact_file provider was meant to be as close-as-possible to Chef's implementation in remote_file.

Basically, the resource should be idempotent enough that if won't redownload the file that's already cached in Chef's file_cache_path - this is implemented by the checksumming mechanism at fault in this issue.

This definitely sounds like a bug. Unfortunately, I don't think we will be able to effectively plan on getting a fix for this, I'd be more than happy to look at / accept a pull request.

@CloCkWeRX
Copy link

chef/chef#2681 is worth a bit of a look re changed behaviour around checksums

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants