~/uas/chef-repos $ knife cookbook upload --all
Uploading helloworld [0.0.0]
Uploading mongodb [0.11.0]
ERROR: Chef::Exceptions::CookbookNotFoundInRepo: Cannot find a cookbook
named apt; did you forget to add metadata to a cookbook?
(http://wiki.opscode.com/display/chef/Metadata)
(Yes, I am brand new to Chef and almost totally bewildered, but I’ve got
high hopes.)
On my development host, I’ve got a subdirectory with
~/uas/chef-repos $ ll
total 20
drwxr-xr-x 5 russ russ 4096 Jun 25 16:28 .
drwxr-xr-x 8 russ russ 4096 May 28 14:46 ..
drwxr-xr-x 2 russ russ 4096 Jun 25 16:28 checksums
drwxr-xr-x 2 russ russ 4096 Jun 17 10:33 .chef
drwxr-xr-x 4 russ russ 4096 Jun 25 16:37 cookbooks
…recipes for tomcat6 and mongodb (under the /cookbooks/ subdirectory)
I downloaded from opscode itself. When I use knife to upload them to
my Chef server, which already has a dummy (hello world) recipe on it, I
get this error message.
Note that I have used knife from here before to do things that have
worked (but not to upload recipes; helloworld actually came down from my
server via knife; someone had already put it there for me to use).
Hi Russ, what you are encountering here is cookbook dependencies. These
are documented in the metadata.rb of the cookbook:
There are a couple of different ways to cope with dependency management.
I believe you can use knife cookbook site install and that will also
pull dependencies that are listed in a metadata file.
A more complex way is to use either Chef-Librarian or Berkshelf, but you
may want to get a little more familiar with Chef before going down that
road as those tools are a bit more complex.
Sascha
Russell Bateman wrote:
~/uas/chef-repos $ knife cookbook upload --all
Uploading helloworld [0.0.0]
Uploading mongodb [0.11.0]
ERROR: Chef::Exceptions::CookbookNotFoundInRepo: Cannot find a
cookbook named apt; did you forget to add metadata to a cookbook?
(http://wiki.opscode.com/display/chef/Metadata)
(Yes, I am brand new to Chef and almost totally bewildered, but I've
got high hopes.)
On my development host, I've got a subdirectory with
~/uas/chef-repos $ ll
total 20
drwxr-xr-x 5 russ russ 4096 Jun 25 16:28 .
drwxr-xr-x 8 russ russ 4096 May 28 14:46 ..
drwxr-xr-x 2 russ russ 4096 Jun 25 16:28 checksums
drwxr-xr-x 2 russ russ 4096 Jun 17 10:33 .chef
drwxr-xr-x 4 russ russ 4096 Jun 25 16:37 cookbooks
...recipes for tomcat6 and mongodb (under the /cookbooks/
subdirectory) I downloaded from opscode itself. When I use knife to
upload them to my Chef server, which already has a dummy (hello world)
recipe on it, I get this error message.
Note that I have used knife from here before to do things that have
worked (but not to upload recipes; helloworld actually came down from
my server via knife; someone had already put it there for me to use).
There are a couple of different ways to cope with dependency management. I believe you can use knife cookbook site install and that will also pull dependencies that are listed in a metadata file.
Also note that if you have two internal cookbooks which depend on each other, it is possible to upload them both with the same "knife cookbook upload cookbook1 cookbook2" command. This way, knife will search for dependencies not only the list of cookbooks that are currently on the server but also the ones that you are involved in uploading.
It's not a good idea (in general) to have two cookbooks that both depend on each other, but sometimes it happens, and knife gives you a way to deal with that problem.
At first, I didn't see what inter-dependency existed especially as I was
only thinking about the two, mongodb and tomcat6, recipes in hand.
In fact, as an extreme beginner, I hadn't even thought about
dependencies yet. But it dawned on me upon reading your comments (both
posts) that the mongodb cookbook, which creates an error message
containing the word "apt", must of course have a dependency on a
cookbook for Aptitude, used to install MongoDB. I got that cookbook down
from opscode and now all of them install. Rockin'!
(For the time being, Sacha, I've decided to try to steal opscode
recipes, but I'll soon graduate to better opportunities of theft as I
begin to recognize the virtues of recipes others are offering.)
Magic; and it gives me hope.
Profuse thanks for the new illumination on my horizon!
There are a couple of different ways to cope with dependency management. I believe you can use knife cookbook site install and that will also pull dependencies that are listed in a metadata file.
Also note that if you have two internal cookbooks which depend on each other, it is possible to upload them both with the same "knife cookbook upload cookbook1 cookbook2" command. This way, knife will search for dependencies not only the list of cookbooks that are currently on the server but also the ones that you are involved in uploading.
It's not a good idea (in general) to have two cookbooks that both depend on each other, but sometimes it happens, and knife gives you a way to deal with that problem.