Chef::Exceptions::ChecksumMismatch when installing

2019-04-06 12:34发布

I get the following error when running vagrant up --provision to set up my development environment with vagrant...

==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af) does not match checksum on content (12f75e)

My chef JSON has the following for nginx:

"nginx": {
"version": "1.7.8",
"user": "deploy",
"init_style": "init",
"modules": [
  "http_stub_status_module",
  "http_ssl_module",
  "http_gzip_static_module"
],
"passenger": {
  "version": "4.0.53",
  "gem_binary": "/home/vagrant/.rbenv/shims/gem"
},
"configure_flags": [
  "--add-module=/home/vagrant/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/passenger-3.0.18/ext/nginx"
],
"gzip_types": [
  "text/plain",
  "text/html",
  "text/css",
  "text/xml",
  "text/javascript",
  "application/json",
  "application/x-javascript",
  "application/xml",
  "application/xml+rss"
]}

and Cheffile has the following cookbook:

cookbook 'nginx'

How do I resolve the Checksum mismatch?

1条回答
劳资没心,怎么记你
2楼-- · 2019-04-06 13:25

The nginx cookbook requires you to edit the checksum attribute when using another version of nginx. The remote_file resource that is causing you an error is:

remote_file nginx_url do
  source   nginx_url
  checksum node['nginx']['source']['checksum']
  path     src_filepath
  backup   false
end

You need to update the checksum value. Specifically node['nginx']['source']['checksum'].

So in your JSON, you would add this line:

"source": {"checksum": "insert checksum here" }

Edit: As pointed out in the comments, the checksum is SHA256. You can generate the checksum of the file like so:

shasum -a 256 nginx-1.7.8.tar.gz
查看更多
登录 后发表回答