厨师食谱的变化导致食谱失败

时间:2014-07-28 23:37:40

标签: chef gitlab berkshelf

我在尝试运行社区食谱来安装GitLab服务器时遇到了一个奇怪的问题。可以找到食谱here。我使用Berkshelf安装所有依赖项,并使用berks upload将它们上传到我的服务器。

我必须更改默认模板目录中的gitconfig模板。 (我有git使用https://而不是git://。)每当我更改cookbook中的文件时(即使是添加注释等轻微更改),我在尝试运行时会收到以下错误:

[2014-07-28T19:30:50-04:00] ERROR: Exception handlers complete
[2014-07-28T19:30:50-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 23.330996387 seconds
[2014-07-28T19:30:50-04:00] ERROR: undefined method `closed?' for nil:NilClass
[2014-07-28T19:30:50-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

下面的堆栈跟踪是在default.rb中进行更改之后,我添加了一条评论说“test”

这是stacktrace:

Generated at 2014-07-28 19:54:21 -0400
NoMethodError: undefined method `closed?' for nil:NilClass
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2789:in `stream_check'
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2709:in `read_body'
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2736:in `body'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_inspectors/api_error_formatting.rb:91:in `rescue in format_rest_error'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_inspectors/api_error_formatting.rb:89:in `format_rest_error'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_inspectors/api_error_formatting.rb:77:in `describe_503_error'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb:69:in `humanize_http_exception'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb:47:in `add_explanation'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/error_mapper.rb:64:in `cookbook_sync_failed'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/formatters/base.rb:155:in `cookbook_sync_failed'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/event_dispatch/dispatcher.rb:29:in `block in cookbook_sync_failed'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/event_dispatch/dispatcher.rb:29:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/event_dispatch/dispatcher.rb:29:in `cookbook_sync_failed'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/cookbook/synchronizer.rb:109:in `rescue in sync_cookbooks'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/cookbook/synchronizer.rb:95:in `sync_cookbooks'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/policy_builder/expand_node_object.rb:179:in `sync_cookbooks'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/policy_builder/expand_node_object.rb:66:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:265:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:429:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:213:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/client.rb:207:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:217:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:328:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application/client.rb:317:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/lib/chef/application.rb:67:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.4/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:23:in `load'
/usr/bin/chef-client:23:in `<main>'

如果我将其切换回来并重新上传到我的服务器,问题就会消失。有没有理由我无法编辑这个社区食谱?

2 个答案:

答案 0 :(得分:1)

事实证明,这是一个代理问题。在深入了解调试输出后,我注意到厨师客户端在初始连接后再次尝试与服务器通信。这次它已经完成了反向查找,并且由于我的反向查找不能正常工作,因此我没有在无代理设置中使用正确的域。但是抛出的错误并不是很清楚。修复是将另一个域添加到client.rb文件中的无代理列表。我删除了我正在使用的食谱并转到官方的gitlab食谱后发现了这一点。我不得不在client.rb中进行更改,并注意到当我添加代理时它就像以前一样打破了客户端运行

答案 1 :(得分:0)

测试一下,

- 删除所有berks缓存食谱

-Delete lockfile

- 下载食谱依赖

- 强制上传到chef-server

步骤:

rm -rf /home/your_user/.berkshelf/cookbooks/*
cd /path_to_gitlab_cookbook
rm -rf Berksfile.lock
berks install
berks upload --force

并重新运行deploy

抱歉我的英文

最好的问候