- From: Joseph Holsten <
>
- To:
- Cc: "
" <
>
- Subject: [chef] Re: run_context.include_recipe in a recipe within a role
- Date: Thu, 30 May 2013 01:44:40 -0700
lusis: I think `include_recipe` is no longer required to access libraries in
chef 11, but I vaguely rembemer this being an issue in chef <= 10. I'm pretty
sure that's why many library cookbooks have nop recipes/default.rb files.
Also, `include_recipe` used to be unavailable in the lwrp dsl, which was one
of the many reasons I just used heavyweight RPs for a long time. I'm pretty
sure this is also no longer true.
And now I want to grumble like an old man. Stupid newfangled DSLs fixing all
the things that confused me when I started...
--
~j
On 2013-05-29, at 12:07, John E. Vincent (lusis)
<
>
wrote:
>
I'm still confused by this. The windows and runit resources, as an example,
>
are not available to a recipe unless include_recipe is used at the top.
>
They've always failed for me otherwise (regardless of including the
>
dependency in metadata.rb). I never bothered to revisit if this was a bug
>
and I've always done include_recipe "runit" (or any recipe for that matter)
>
where I needed the resources from that LWRP in the recipe itself.
>
>
I'm totally willing to admit I've been wrong all this time but there was a
>
reason I did it at one point and it fixed the problem at the time. I just
>
never went back and challenged that assumption.
>
>
>
On Wed, May 29, 2013 at 2:58 PM, Ranjib Dey
>
<
>
>
wrote:
>
no.. you dont have to.. the libraries and lwrps are available just by
>
declaring the dependency, u dont have to include the parent cookbook's
>
default or any other recipe.
>
>
>
>
>
On Wed, May 29, 2013 at 11:00 AM, Cassiano Leal
>
<
>
>
wrote:
>
Just to understand better, do I actually need to include a library
>
cookbook's recipe in the run_list of a node in order to use its LWRPs?
>
>
I remember a thread not long ago in this mailing list about "how to test
>
library cookbooks without recipes" or something like that, and someone
>
specifically mentioned that requiring the lib cookbook in the metadata file
>
would be enough.
>
>
Just checking. :)
>
>
- cassiano
>
>
On Wednesday, May 29, 2013 at 14:45, Ranjib Dey wrote:
>
>
> i think both are fine, the non lwrp way. u'll be introducing the
>
> conditionals inside the recipe.. which will
>
> 1) reduce the declarativeness of the recipe
>
> 2) u'll be limited by the compile time info , in certain cases
>
> 3) testing will be harder
>
>
>
> the lwrp opens up a much cleaner way to reuse this, brings the
>
> conditionals inside an abstraction, and also allows you to set your
>
> resource's update status depending upon the entire dependency (i.e. now
>
> you can say i was updated if any of the dependant resource were update),
>
> which you might exploit using notification mechanism is anywhere else...
>
> u'll lose most of this if you push these logic in the recipe...
>
> no?
>
>
>
>
>
> On Wed, May 29, 2013 at 10:38 AM, Sean Escriva
>
> <
>
>
> wrote:
>
>> very neat.
>
>>
>
>> Notifications from the lwrp are one thing, but IMO include_recipe
>
>> shouldn't need to be in the lwrp because as John mentioned the cookbook
>
>> that provides the lwrp still needs to be included to make use of the
>
>> specific lwrp and as such will run the default recipe. It should also
>
>> result in a simpler lwrp. This seems easier to reason about as well since
>
>> the lwrp is not the distribution mechanism for functionality, the
>
>> cookbook is.
>
>>
>
>> As Dan said though, we probably need to see more code to understand the
>
>> full issue
>
>>
>
>>
>
>>
>
>> On Wed, May 29, 2013 at 10:07 AM, Ranjib Dey
>
>> <
>
>
>> wrote:
>
>>>
>
>>> i think its fine to include recipes via provider (or rather execute a
>
>>> whole recipe)
>
>>>
>
>>> create a subcontext , and a mini chef run inside it, and converge the
>
>>> node. this is how we used to reuse existing chef resource inside an lwrp
>
>>> earlier..
>
>>> yfeldblum had a gist on it..
>
>>>
>
>>> http://realityforge.org/code/2012/07/17/lwrp-notify-on-changed-resources.html
>
>>>
>
>>>
>
>>>
>
>>>
>
>>> On Wed, May 29, 2013 at 9:46 AM, Dorian Jaminais
>
>>> <
>
>
>>> wrote:
>
>>>> Yes this can be a workaround, still I don't think the behavior I am
>
>>>> getting is normal (and don't understand why) and I'd prefer to find a
>
>>>> cleaner way than having to add a recipe just to include other recipes
>
>>>> whereas it should be the task of my LWRP.
>
>>>>
>
>>>>
>
>>>> 2013/5/29 John E. Vincent (lusis)
>
>>>> <
>
>
>>>>
>
>>>>> Is there a reason you wouldn't, however, just add the "include_recipe"
>
>>>>> statements to the default recipe for the LWRP cookbook then? It's not
>
>>>>> uncommon to do that even for library cookbooks iirc and it gets around
>
>>>>> (I think) the issue you're describing.
>
>>>>>
>
>>>>>
>
>>>>> On Wed, May 29, 2013 at 12:39 PM, Dorian Jaminais
>
>>>>> <
>
>
>>>>> wrote:
>
>>>>>> Okay
>
>>>>>>
>
>>>>>> I am using a LWRP instead of a recipe because I want to deploy about
>
>>>>>> 15 applications that are very similar.
>
>>>>>> All those applications have a dedicated cookbook but as the
>
>>>>>> installation process is always the same work flow, I have factorized
>
>>>>>> it into a LWRP.
>
>>>>>>
>
>>>>>> The work flow is pretty simple : assert that installation
>
>>>>>> dependencies are met, clone the repo, bundle install the needed gems.
>
>>>>>>
>
>>>>>> I have attached my provider to this mail (which by the way is
>
>>>>>> included in a cookbook named gios).
>
>>>>>>
>
>>>>>> In each application's cookbook I use :
>
>>>>>> gios_installer NAME do
>
>>>>>> name NAME
>
>>>>>> repository GIT_URI
>
>>>>>> command "./bin/truc"
>
>>>>>> version "master"
>
>>>>>> action :install
>
>>>>>> end
>
>>>>>>
>
>>>>>> As stated in my previous emails, using the LWRP that way will include
>
>>>>>> the recipes ruby, git, base::certificate, pm-openssh::rsa and
>
>>>>>> pm-openssh::known_hosts only if the LWRP is called exactly once in
>
>>>>>> the run_list.
>
>>>>>>
>
>>>>>> Thanks for your help
>
>>>>>>
>
>>>>>>
>
>>>>>> 2013/5/29 Daniel DeLeo
>
>>>>>> <
>
>
>>>>>>>
>
>>>>>>> On Wednesday, May 29, 2013 at 9:06 AM, Dorian Jaminais wrote:
>
>>>>>>>
>
>>>>>>>> I am still tracking down my problem and I have some news.
>
>>>>>>>> It appears that he problem is not specific to the git cookbook.
>
>>>>>>>> Indeed it appears that all recipes included in a LWRP
>
>>>>>>>> 'run_context.include_recipe' is only really added to the run_list
>
>>>>>>>> if the LWRP is called once during the run_list.
>
>>>>>>>>
>
>>>>>>>> If the LWRP is called more than once, it tells me that the resource
>
>>>>>>>> has already been added to the run_list even if it has not.
>
>>>>>>>>
>
>>>>>>>> Is this a known bug ? I am doing something wrong ?
>
>>>>>>>> I am failing to find any clues using my google-fu so I am turning
>
>>>>>>>> to your expertise.
>
>>>>>>>>
>
>>>>>>>>
>
>>>>>>>> 2013/5/29 Dorian Jaminais
>
>>>>>>>> <
>
>
>>>>>>>>> Hi everyone
>
>>>>>>>>>
>
>>>>>>>>> I am having trouble with LWRP, include_recipe and roles.
>
>>>>>>>>>
>
>>>>>>>>> I have a LWRP that includes some cookbooks :
>
>>>>>>>>> run_context.include_recipe "git"
>
>>>>>>>>> run_context.include_recipe "internal-cookbook"
>
>>>>>>>>> run_context.include_recipe "build-essential"
>
>>>>>>>>>
>
>>>>>>>
>
>>>>>>> This is a bit odd. Why does the LWRP do this instead of a recipe?
>
>>>>>>> Showing more code, log output, and explaining why you're doing
>
>>>>>>> things this way would help others to understand your issue better.
>
>>>>>>>
>
>>>>>>> --
>
>>>>>>> Daniel DeLeo
>
>>>>>>
>
>>>>>>
>
>>>>>>
>
>>>>>> --
>
>>>>>> Dorian JAMINAIS
>
>>>>>> System Administrator
>
>>>>>> +33 6 95 10 95 37
>
>>>>>>
>
>>>>>>
>
>>>>>>
>
>>>>>
>
>>>>
>
>>>>
>
>>>>
>
>>>> --
>
>>>> Dorian JAMINAIS
>
>>>> System Administrator
>
>>>> +33 6 95 10 95 37
>
>>>>
>
>>>>
>
>>>>
>
>>>
>
>>
>
>
>
>
>
- [chef] Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, (continued)
- [chef] Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Ranjib Dey, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Sean Escriva, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Ranjib Dey, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Cassiano Leal, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Ranjib Dey, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, John E. Vincent (lusis), 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Daniel DeLeo, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Jesse Nelson, 05/29/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Peter Donald, 05/30/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: run_context.include_recipe in a recipe within a role, Dorian Jaminais, 05/30/2013
- [chef] Re: run_context.include_recipe in a recipe within a role, Joseph Holsten, 05/30/2013
[chef] Re: Re: run_context.include_recipe in a recipe within a role, Ranjib Dey, 05/29/2013
Archive powered by MHonArc 2.6.16.