[chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role


Chronological Thread 
  • From: Dorian Jaminais < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role
  • Date: Sun, 16 Jun 2013 14:34:41 +0200

Indeed that is exactly the same issue I had been running into.

For now I use to proposed workaround to include all those recipes from another recipe.

Maybe I should open a ticket on that issue.


2013/6/14 Jesse Campbell < " target="_blank"> >
I am using the "application" and "application_java" cookbooks, which include_recipe "tomcat" in the LWRP, and i've brought the same code over to an new cookbook for tomeeplus.

include_recipe is working fine if I only run the LWRP precisely one time.
if i run the LWRP more than one time, the include_recipe gets ignored.

this sounds like the same as the OP's issue.
I can't (easily) change the "base" cookbook, because the base cookbook is "application"




On Thu, May 30, 2013 at 8:22 AM, Dorian Jaminais < " target="_blank"> > wrote:
Thank you all for your responses.

@peter : run_context.include_recipe works but only if the LWRP is called once in during the chef_run.

I have included a recipe that installs all the dependencies for the LWRP to work.
This works perfectly, even if still I don't understand why I had this strange behavior with run_context.include_recipe


2013/5/30 Peter Donald < " target="_blank"> >
Hi,

On Thu, May 30, 2013 at 8:43 AM, Daniel DeLeo < " target="_blank"> > wrote:
> Bringing this back to the OP's issue, I think including a recipe (the normal
> way) to install prerequisites of a LWRP is the right way to go about it. If
> you are doing wizardry with chef internals, either 1) you're making
> something more complicated than it should be, 2) chef is making something
> more complicated than it should be, or 3) you're a wizard. So far, I'm
> inclined to think that including recipes from a provider falls into category
> #1, since you can just as easily and elegantly solve the problem with a role
> (or role cookbook if that's your thing). Am I missing something?

I think it is more useful to see it as a failure of chef rather than a
failure of the user. i.e. Option 2.

In my mind LWRPs  are a mechanism for creating composable
abstractions. Anything you can do in a recipe should be possible to do
in a LWRP. Where this is not true I would consider it a bug.

For this specific scenario I can easily see a use for it. In our
environment, many of our recipes are data driven. Data is collected
from search + rules + external systems (ldap/db etc) and then this is
interpreted and resources defined based on the data. So often we will
not know which LWRPs will be active (and thus which precursor recipes
should be included) until the data is interpreted.

That said I thought include_recipe worked from within LWRPs...


--
Cheers,

Peter Donald



--
Dorian JAMINAIS
System Administrator
+33 6 95 10 95 37







--
Dorian JAMINAIS
System Administrator
+33 6 95 10 95 37






Archive powered by MHonArc 2.6.16.

§