简体   繁体   English

Chef-solo-Tuto:错误解析运行清单的食谱

[英]chef-solo - Tuto : Error Resolving Cookbooks for Run List

I'm trying to follow the chef-solo tuto available at http://gettingstartedwithchef.com/first-steps-with-chef.html 我正在尝试遵循http://gettingstartedwithchef.com/first-steps-with-chef.html上的Chef-solo tuto

But when I type "chef-solo -c solo.rb -j web.json", I have the following error message 但是,当我键入“ 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$

I'm using a virtual box VM with vagant (Ubuntu Precise). 我使用的是带有流浪汉(Ubuntu Precise)的虚拟盒子虚拟机。 I'm using the vagrant directory to store the files and I'm logged with the vagrant user, there are only these differences with the tuto. 我使用的是vagrant目录来存储文件,并以vagrant用户登录,tuto仅存在这些差异。 So I have replaced 所以我已经取代

echo "cookbook_path [ '/root/chef-repo/cookbooks' ]" > .chef/knife.rb

by 通过

echo "cookbook_path [ '/vagrant/chef-repo/cookbooks' ]" > .chef/knife.rb

and in the solo.rb file 并在solo.rb文件中

file_cache_path "/root/chef-solo"
cookbook_path "/root/chef-repo/cookbooks"

by 通过

file_cache_path "/vagrant/chef-solo"
cookbook_path "/vagrant/chef-repo/cookbooks"

Where is the mistake ? 错误在哪里?

Please see below the chef-stacktrace.out file contents : 请在下面查看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>'

Unfortunately that tutorial is several years out of date, which you can tell from how old the self-reported version of chef-client is shown to be. 不幸的是,该教程已经过时了数年,您可以从所示的chef-client的自我报告版本中看出多少。 You can find the current Chef tutorial at https://learn.chef.io/ 您可以在https://learn.chef.io/找到当前的Chef教程。

To answer the actual question: one of the cookbooks you are using in the example has a dependency on another community cookbook, so the dependency must be present for it to function. 要回答一个实际的问题:在示例中使用的一本食谱对另一本社区食谱有依赖关系,因此必须存在依赖关系才能使其起作用。 This is handled automatically by newer cookbook download tools like Berkshelf and Policyfiles. 较新的食谱下载工具(例如Berkshelf和Policyfiles)会自动处理此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM