I seen this error while i was working with multiple recipies with in a single cookbook, guess this post will help you if you are hitting the same issue. Take a look at this error
ubuntu@webserver:~$ sudo chef-client Starting Chef Client, version 11.8.2 resolving cookbooks for run list: [“web”, “web_v2”] ================================================================================ Error Resolving Cookbooks for Run List: ================================================================================ Missing Cookbooks: ------------------ The following cookbooks are required by the client but don't exist on the server: * web_v2 Expanded Run List: ------------------ * web * web_v2 [2015-05-20T20:27:19+05:30] ERROR: Running exception handlers [2015-05-20T20:27:19+05:30] ERROR: Exception handlers complete [2015-05-20T20:27:19+05:30] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out Chef Client failed. 0 resources updated [2015-05-20T20:27:19+05:30] ERROR: 412 "Precondition Failed" [2015-05-20T20:27:19+05:30] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
this says cookbook is not found for this recipe, but i added new recipe "web_v2" to nodes runlist, as below
ubuntu@webserver~$ knife node edit web-server { "name": “web-server”, "chef_environment": "_default", "normal": { }, "run_list": [ "recipe[web]”, "recipe[web_v2]” ] }
i added my second recipe entry just like above then why the hell it was throwing error, saying "cookbook doesn't exists"
reason is ...
First recipe web is a default recipe of a cookbook web, which is called as default recipe. If you explicitly don't mention cookbook name in runlist , chef tries to find out cookbook with the name of recipe that's why it was working.
coming to second recipe which is not a default one, chef couldn't make it out because there is no cookbook with the name "web_v2", so here you have to explicitly mention to which cookbook this recipe belongs to ....
finally i found the cause and modified my node's runst as below
ubuntu@webserver~$ knife node edit web-server { "name": “web-server”, "chef_environment": "_default", "normal": { }, "run_list": [ "recipe[web]”, "recipe[web::web_v2]” ] }
now it works perfectly.... you want to see chef-client output ?? compare the below output with output in the beginning of the post to find where the error is.
ubuntu@webserver:~$ sudo chef-client Starting Chef Client, version 11.8.2 resolving cookbooks for run list: ["web", "web::web_v2"] Synchronizing Cookbooks: - web Compiling Cookbooks...
compare the line "resolving cookbooks for run lists" before and after editing runlist.
before modifying node
resolving cookbooks for run list: ["web", "web_v2"]
after modifying , where it's working.
resolving cookbooks for run list: ["web", "web::web_v2"]difference is non default recipe has cookbook name as prefix (web::web_v2)
gil ...
0 Comments