Thanks, Dreamcat4.
I found the rake task, but it is just a wrapper for knife.
It finally worked by creating a .chef/knife.rb file containing:
node_name "virtualbox"
But it keeps complaining about the missing cookbook.
Running chef-client with strace gives the following:
$ sudo strace chef-solo -c solo.rb -l debug 2>&1 | grep cookbooks
open("/cookbooks", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|
O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/site-cookbooks", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|
O_CLOEXEC) = -1 ENOENT (No such file or directory)
I don't know why chef-solo is looking for cookbooks in /cookbooks
and /site-cookbooks.
Please note I have no /etc/chef directory.
Symlinking the cookbooks/site-cookbooks subdirs of my chef repo to /
works.
But that's ugly 
Here is the content of my solo.rb file:
$ cat solo.rb
current_dir = File.dirname(FILE)
file_cache_path current_dir
cookbook_path ["#{current_dir}/cookbooks",
"#{current_dir}/site-cookbooks"]
json_attribs "#{current_dir}/solo.json"
role_path "#{current_dir}/roles"
And my solo.json file:
$ cat solo.json
{
"run_list": [ "recipe[my_cookbook]" ]
}
And I run chef-solo like this:
$ sudo chef-solo -c solo.rb
I downloaded and installed rubygems manually, and I'm using the latest
chef gem.
Any idea ?
Le mercredi 20 octobre 2010 à 13:16 +0100, Dreamcat4 a écrit :
It should be possible to generate the metadata by running a rake task
(Rakefile in the chef-repo parent folder, a seperate git-repository for
containing your cookbooks).
Assuming its still there - as havent used it recently.
2010/10/20 Sébastien Nicouleaud sebastien.nicouleaud@gmail.com:
I want to develop cookbooks and test them in virtualbox before using
them in production.
Having to upload my cookbooks to the chef server and run chef-client
from virtualbox everytime I make a little change seems like overkill...
So I clone my chef repository in virtualbox, write a solo.rb file to
make my cookbooks_path point to the cookbooks dir of my repository, and
a solo.json file to make it use my recipe.
But when I run chef-solo, it says my cookbook is not found. I suppose it
has something to do with the metadata.json file of my cookbook not being
generated.
So I try to generate the metadata using the knife cookbook metadata
subcommand, but knife now complains about the chef server authentication
(which I didn't set up since I wanted to use chef-solo).
So, my question is: is there a way to develop and test cookbooks locally
without any chef server ?
Or am I missing something ?
Seb