[chef] Re: Re: How does a definition know which file or template to use?


Chronological Thread 
  • From: Jonathan Ferguson < >
  • To:
  • Subject: [chef] Re: Re: How does a definition know which file or template to use?
  • Date: Fri, 8 Oct 2010 16:57:33 +1100

comments inlined.

On 8 October 2010 14:29, Seth Falcon < "> > wrote:
Hi Jono,

On Thu, Oct 7, 2010 at 7:10 PM,  < "> > wrote:
> I have a definition that uses several files and templates to build a
> tomcat base skeleton. When I call the definition from a recipe in
> another cookbook it can not find the files nor templates as it is
> looking in the callers cookbooks instead of the definitions.
>
> Can I direct the definition to look in the correct place or is there an
> idiomatically chef way of accomplishing this?

I think you want to specify the cookbook parameter in the resources in
your definition.

E.g.

   define :mydef do
     template "/opt/so/and/so" do
       # stuff
       cookbook "mydef"
     end
   end

Does that help?  You might look at the runit cookbook in the Opscode
cookbooks repo
for an example of using (rather involved) definitions.

    This was perfect, thank you.  I couldn't find anything in the documentation about this, did I miss it? ( interested, not a jib :) ) 

Cheers 
Jono
 

+ seth




Archive powered by MHonArc 2.6.16.

§