Hi!
I’m trying to develop a application that uses Chef for deploying Software.
Because of that, I need to get all available cookbooks. I found the
CookbookLoader-class but it seems that it doesn’t work.
When I try
c_list = Chef::CookbookLoader.new
I can’t access any cookbook. Trying to get the apache2 cookbook I get the error
/usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/cookbook_loader.rb:126:in
`[]’: Cannot find a cookbook named apache2; did you forget to add metadata to a
cookbook? (http://wiki.opscode.com/display/chef/Metadata) (ArgumentError)
but I have no idea why it isn’t working.
Any suggestions?
Ohai!
Hard to say without seeing more of your code, but my first guess is
that you need to setup Chef::Config and make sure the :cookbook_path
config option is set.
If you're just doing require 'chef'
you should get Chef::Config
loaded so you could just do Chef::Config[:cookbook_path] =
'/your/cookbook/path' before running CookbookLoader#load_cookbooks.
HTH,
Dan DeLeo
On Wed, Feb 17, 2010 at 6:29 AM, matthias@splieth.com wrote:
Hi!
I'm trying to develop a application that uses Chef for deploying Software.
Because of that, I need to get all available cookbooks. I found the
CookbookLoader-class but it seems that it doesn't work.
When I try
c_list = Chef::CookbookLoader.new
I can't access any cookbook. Trying to get the apache2 cookbook I get the error
/usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/cookbook_loader.rb:126:in
`': Cannot find a cookbook named apache2; did you forget to add metadata to a
cookbook? (http://wiki.opscode.com/display/chef/Metadata) (ArgumentError)
but I have no idea why it isn't working.
Any suggestions?
Hi Daniel!
That was exactly the problem. I was wondering that your proposal worked
because I already checked if the cookbook_path was set.
Thanks for your help! 
Daniel DeLeo wrote:
Ohai!
Hard to say without seeing more of your code, but my first guess is
that you need to setup Chef::Config and make sure the :cookbook_path
config option is set.
If you're just doing require 'chef'
you should get Chef::Config
loaded so you could just do Chef::Config[:cookbook_path] =
'/your/cookbook/path' before running CookbookLoader#load_cookbooks.
HTH,
Dan DeLeo
On Wed, Feb 17, 2010 at 6:29 AM, matthias@splieth.com wrote:
Hi!
I'm trying to develop a application that uses Chef for deploying Software.
Because of that, I need to get all available cookbooks. I found the
CookbookLoader-class but it seems that it doesn't work.
When I try
c_list = Chef::CookbookLoader.new
I can't access any cookbook. Trying to get the apache2 cookbook I get the error
/usr/lib/ruby/gems/1.8/gems/chef-0.7.16/lib/chef/cookbook_loader.rb:126:in
`': Cannot find a cookbook named apache2; did you forget to add metadata to a
cookbook? (http://wiki.opscode.com/display/chef/Metadata) (ArgumentError)
but I have no idea why it isn't working.
Any suggestions?