[chef] Re: Re: Re: Re: Re: Re: Re: Re: yum::epel problems in wrapped cookbook


Chronological Thread 
  • From: Jeffrey Jones < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: yum::epel problems in wrapped cookbook
  • Date: Tue, 18 Jun 2013 10:45:04 +0900
  • Organization: Toppan Forms


On 18/06/13 10:09, Jeffrey Jones wrote:

On 18/06/13 01:24, Daniel DeLeo wrote:

On Sunday, June 16, 2013 at 7:25 PM, Jeffrey Jones wrote:

Hello Steven

On 15/06/13 06:22, Steven Danna wrote:
On 6/14/13 7:57 AM, Julian C. Dunn wrote:
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...
I have added the debug output after adding the "include_attribute" section.
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
As 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:

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

Hello Daniel.

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.

§