Hi Jeff,
Chef does not know anything about Berksfile, thus it only checks metadata.rb, thus you have to keep both in sync.
And yes, in metadata.rb you can not specify an alternative cookbook soure (like a git location).
The best way is to use declare all dependencies in metadata.rb, then in the Berksfile use the "metadata" keyword. For any custom-located cookbooks repeat them in the Berksfile (with a git location for example) - this will override their location.
Then you can do "berks install" (followed by "berks upload" if you are using chef server) and it will respect the git location.
HTH, Torben
On 18/06/13 10:09, Jeffrey Jones wrote:
On 18/06/13 01:24, Daniel DeLeo wrote:
Hello Daniel.
On Sunday, June 16, 2013 at 7:25 PM, Jeffrey Jones wrote:
Hello StevenAs Julian said, the key here is that you need to specify the dependency between your cookbook and the yum cookbook in the cookbook's metadata:
On 15/06/13 06:22, Steven Danna wrote:
On 6/14/13 7:57 AM, Julian C. Dunn wrote:I have added the debug output after adding the "include_attribute" section.
Hey Jeffrey: I don't see your recipe code anywhere but judging from the
gist you have something like this:
connector::default has include_recipe "torquebox-web-server"
torquebox-web-server::default has include_recipe "yum::epel"
Is "yum" anywhere in your metadata for any of those cookbooks?
Even I'm not entirely sure whether include_recipe also loads attributes
from the dependent cookbook...
It looks like the old error has been fixed but a new error has appeared.
"[2013-06-17T02:12:46+00:00] FATAL: NameError: Cannot find a resource
for yum_key on centos version 6.4"
I am guessing that the attributes/epel.rb file is being executed by the
selection logic inside the file is failing for some reason?
https://gist.github.com/rurounijones/5771208 ("Add attribute" section
for full debug output)
Cheers
Jeff
http://docs.opscode.com/essentials_cookbook_metadata.html
Chef 11 uses the metadata to figure out a sane order for cookbook loading. If a cookbook doesn't appear in either the run list or dependencies of a cookbook in the run_list, it will not get loaded correctly. As you've seen, you can work around this a little bit with include_recipe and include_attribute, but you won't load libraries, resource definitions, or LWRPs. Adding the dependency in the metadata is the only way to make those work.
--
Daniel DeLeo
I have the the "torquebox-web-server" cookbook which is wrapped and I have the "connector" cookbook which is the wrapper.
In the "torquebox-web-sever" cookbook's "metadata.rb" file I have the line: depends 'yum', '2.2.2'
So the dependency is specified in the wrapped cookbook and using the torquebox-web-server cookbook directly works fine.
In the "connector" cookbook I depend on the "torquebox-web-server" cookbook using a Berksfile entry (Which, it has just occurred to be, may be a factor in this issue).
My understanding is that Chef should pick up the dependencies from the wrapped cookbooks automatically during convergence so that they do not need to be re-declared in the wrapper cookbook. Is my understanding correct?
I am not sure how exactly it does the dependency checking. Does specifying a dependency is the Berksfile means it won't be properly picked up by chef in this scenario?
Thanks for the information.
Jeff
Further to last email (After I realised it may be due to using berkshelf) I did some experimentation. Using berkshelf I installed the "torquebox-web-server" cookbook (and others) into the site-cookbooks directory in the "connector" cookbook then added a "depends 'torquebox-web-server' "dependency into the "connector" metadata.rb file
This appears to have worked. It is not the most elegant solution but until we can use chef-solo with entries in the metadata.rb file that can point to arbitrary remote git repositories I cannot think of a better one (Any suggestions?).
Thanks for helping with my understanding.
Jeff
Archive powered by MHonArc 2.6.16.