Alexander Ponomarev
Alexander Ponomarev

Reputation: 2728

Cookbook python not found

I try to install python with chef solo.

To make it I do

chef-solo -c solo.rb -j chef.json

solo.rb:

file_cache_path "/tmp/chef-solo"
cookbook_path   "/home/lamerman/.berkshelf/cookbooks"

chef.json:

{
    "run_list": [ "recipe[python]" ]
}

ls -l /home/lamerman/.berkshelf/cookbooks

...
drwxrwxr-x 8 lamerman lamerman 4096 Sep 15 13:16 python-1.4.6
...

Why do I get

ERROR: Cookbook python not found. If you're loading python from another cookbook, 
make sure you configure the dependency in your metadata

It seems like everything is right.

Upvotes: 0

Views: 315

Answers (1)

Holger Just
Holger Just

Reputation: 55718

Berkshelf and Chef itself use different directory structure than berkshelf. The main difference is that Berkshelf can have multiple versions of a cookbook installed while chef can not. In chef's world, the cookbook name must be the directory name, without any additions.

Thus, you can't just point the solo.rb to the berkshelf directory. Instead, you have to instruct Berkshelf to create a directory structure suitable for chef from its cache. This is akin to create a snapshot from the current state.

Thus, typically, you can run this in your chef repository (i.e. the directory that contains your Berksfile) to create a cookbooks directory suitable for chef:

berks install --path /path/to/your/chef/repo/cookbooks

Then, in your solo.rb, you can tell chef to use this snapshot directory

file_cache_path "/tmp/chef-solo"
cookbook_path   "/path/to/your/chef/repo/cookbooks"

Note that the names of the directories inside the cookbooks directory have no version appended. That is the way, chef requires it.

Upvotes: 1

Related Questions