简体   繁体   中英

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

But when I type "chef-solo -c solo.rb -j web.json", I have the following error message

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). 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. 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

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 :

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. You can find the current Chef tutorial at https://learn.chef.io/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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