Cookbook not found : Chef Solo

14,010

Solution 1

A few things.

With Chef Solo, you have to tell it more information up front so it finds the cookbooks.

  1. It needs to know what run list (and node attributes if any) to use for the run. This is the "json file" passed with the -j option.

  2. It needs to know the path to the cookbooks. You can download them from a remote tarball with the -r option, and let it handle the rest, or you have to write a config file with the cookbook_path value and un-archive the cookbooks you want to use in that directory. This is c:\var\chef\cookbooks by default.

Also, the Opscode Chef Community Site is not the same as the "Cookbooks" organization on GitHub.

Opscode's Java cookbook does not work on Windows. You'll need to write your own or find another one that does.

Finally, the Chef mailing lists and IRC channels are the best way to get help with Chef quickly.

Solution 2

You need to add one line in metadata.rb file. depends "cookbookname" for your issue goto metadata file of oc-java-master and write

depends "java"

Please verify that cookbook java is present into your cookbook path

Solution 3

In my case I was using Vagrant with chef_solo provider. It appears that the folder /tmp/vagrant-chef/a0544031e745d8ec23aa205c03bf9231 on the target chef node (in my case a Vagrant managed VM)is where this provider caches cookbooks. This folder was empty for some reason causing chef_solo to not find any cookbooks. Perhaps it was empty because I interrupted an execution (Only a guess).

I deleted /tmp/vagrant-chef entirely and then did "vagran reoad" followed by "vagrant provision" command. This created a new copy of the /tmp/vagrant-chef/a0544031e745d8ec23aa205c03bf9231/cookbooks tree and this time everything worked just fine and I no longer got "Cookbook not found"

Share:
14,010
dharam
Author by

dharam

Updated on June 08, 2022

Comments

  • dharam
    dharam almost 2 years

    I downloaded the cookbook "oc-java-master" from the Chef community and now I am trying to run it using chef-solo which i have installed on a Windows Server 2008.

    After a lot of googling and stackoverflow support i was able to get the JSON file picked up which defines the run lists. But the below error has been troubling me for last 4-5 hours and I am totally clueless.

    [2012-11-28T11:33:28+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook java not found. If you're loading java from another cookbook, make sure you configure the dependency in your metadata

    If anyone can look at the cookbook and suggest me some solution I will be grateful to you. The URL of the cookbook is here.

  • arvindwill
    arvindwill almost 10 years
    Guys as @jtimberman told in (2) create a cookbook_path in any config file (solo.rb) . One thing take care while specifying the path use '\\' instead of '\' . for eg: cookbook_path "G:\\stutzen\\chef\\chef-solo-eg\\cookbooks\\"