【发布时间】:2016-06-29 16:07:26
【问题描述】:
我正在尝试关注 http://gettingstartedwithchef.com/first-steps-with-chef.html 上的 chef-solo tuto
但是当我输入“chef-solo -c solo.rb -j web.json”时,我有以下错误信息
vagrant@precise64:/vagrant/chef-repo$ sudo chef-solo -c solo.rb -j web.json
Starting Chef Client, version 12.11.18
resolving cookbooks for run list: ["apt", "phpapp"]
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: compat_resource
Expanded Run List:
------------------
* apt
* phpapp
Platform:
---------
x86_64-linux
Running handlers:
[2016-06-28T16:30:44+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-06-28T16:30:44+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 seconds
[2016-06-28T16:30:44+00:00] FATAL: Stacktrace dumped to /vagrant/chef-solo/chef-stacktrace.out
[2016-06-28T16:30:44+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-28T16:30:44+00:00] ERROR: 412 "Precondition Failed"
[2016-06-28T16:30:45+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
vagrant@precise64:/vagrant/chef-repo$
我正在使用带有 vagant 的虚拟机 (Ubuntu Precise)。 我正在使用 vagrant 目录来存储文件,并且我使用 vagrant 用户登录,与 tuto 仅存在这些差异。 所以我换了
echo "cookbook_path [ '/root/chef-repo/cookbooks' ]" > .chef/knife.rb
通过
echo "cookbook_path [ '/vagrant/chef-repo/cookbooks' ]" > .chef/knife.rb
在solo.rb文件中
file_cache_path "/root/chef-solo"
cookbook_path "/root/chef-repo/cookbooks"
通过
file_cache_path "/vagrant/chef-solo"
cookbook_path "/vagrant/chef-repo/cookbooks"
错在哪里?
请看下面的 chef-stacktrace.out 文件内容:
Generated at 2016-06-28 16:30:44 +0000
Net::HTTPServerException: 412 "Precondition Failed"
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/http.rb:146:in `request'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/http.rb:127:in `post'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/policy_builder/expand_node_object.rb:204:in `sync_cookbooks'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/policy_builder/expand_node_object.rb:83:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/client.rb:510:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/client.rb:280:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:286:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:274:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:274:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:239:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:227:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/client.rb:456:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/client.rb:443:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/client.rb:442:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/client.rb:442:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/client.rb:426:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/lib/chef/application/solo.rb:217:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:52:in `load'
/usr/bin/chef-solo:52:in `<main>'
【问题讨论】:
标签: chef-infra chef-solo