[chef] Re: Re: Re: Include a Recipe in a Provider


Chronological Thread 
  • From: AJ Christensen < >
  • To:
  • Subject: [chef] Re: Re: Re: Include a Recipe in a Provider
  • Date: Fri, 30 Dec 2011 11:13:49 +1300

On 30 December 2011 11:11, Andrea Campi 
< >
 wrote:
> On Thu, Dec 29, 2011 at 8:31 PM, Joshua Timberman 
> < >
>  wrote:
>> Hello,
>>
>> On Dec 29, 2011, at 12:04 PM, 
>> < >
>>  wrote:
>>
>>> Is it possible to include a recipe in a provider? I have tried using the
>>> include_recipe function both inside the action definition and outside but 
>>> it
>>> doesn't seem to be available that way.
>>
>>
>> No, include_recipe isn't available in cookbook providers/ directories.
>
> Actually, there is a way:
>
> action :create do
>  run_context.include_recipe "apache2"

Does this include the recipe in the outer node context, or the new
context defined in the LWRP? I had some trouble with this WRT
MiniTest, ended up using compile time resources for everything.

If it is being included in the outer node context, this will be  fine,
and recipes won't be duplicated.. but if this is a new context for the
LWRP, there is a chance to run a recipe twice - once inside of the
lwrp run_context, and once out.. if I recall correctly, or it hasn't
been fixed.. :) Careful now!

--AJ

>
>  ...
> end
>
>
> That works just fine in my experience.
>
> Andrea



Archive powered by MHonArc 2.6.16.

§