chef-solo - Tuto:错误解析运行列表的食谱

时间:2016-06-28 17:03:28

标签: chef chef-solo

我正在尝试关注http://gettingstartedwithchef.com/first-steps-with-chef.html

提供的厨师独奏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$

我正在使用虚拟盒虚拟机(Ubuntu Precise)。 我正在使用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>'

1 个答案:

答案 0 :(得分:0)

不幸的是,该教程已经过时了几年,您可以看出自我报告的chef-client版本的显示年龄。您可以在https://learn.chef.io/

找到当前的Chef教程

要回答实际问题:您在示例中使用的其中一个烹饪书依赖于另一个社区食谱,因此必须存在依赖性才能使其正常运行。这是由较新的食谱下载工具(如Berkshelf和Policyfiles)自动处理的。

相关问题