从源代码安装nginx-1.7.8时,Chef :: Exceptions :: ChecksumMismatch

时间:2014-12-08 20:58:15

标签: nginx centos vagrant chef

运行vagrant up --provision以设置带有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)

我的厨师JSON对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"
]}

和Cheffile有以下食谱:

cookbook 'nginx'

如何解决校验和不匹配问题?

1 个答案:

答案 0 :(得分:14)

nginx cookbook要求您在使用其他版本的nginx时编辑checksum属性。导致您出错的remote_file资源是:

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

您需要更新校验和值。具体来说是node['nginx']['source']['checksum']

因此,在您的JSON中,您将添加以下行:

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

编辑:正如评论中所指出的,校验和是SHA256。您可以像这样生成文件的校验和:

shasum -a 256 nginx-1.7.8.tar.gz