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


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Re: run_context.include_recipe in a recipe within a role
  • Date: Wed, 29 May 2013 10:39:15 -0700

try this

rc =run_context.dup
rc.resource_collection = Chef::ResourceCollection.new
rc.load_recipe("foo::bar")
Chef::Runner.new(rc).converge

.. for your case u'll be adding all the recipes, 
make sure u capture the updated  resources. and set the new_resource.updated_by_last_action accordingly





On Wed, May 29, 2013 at 9:06 AM, Dorian Jaminais < " target="_blank"> > 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 < " target="_blank"> >
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"


The git cookbook is the one available at opscode.
I use this recipe in a variety of other internal cookbooks.

Here is my problem : when I add the cookbooks that use the LWRP directly to a node's run_list, it works perfectly but when I add them via a role, git is not installed. It works for the two other recipes included in the LWRP but not for git.

In the logs I have :
    DEBUG: Loading Recipe git via include_recipe
    DEBUG: Found recipe default in cookbook git

and then it goes to the next cookbook without the expected
    INFO: Processing package[git] action install (base::default line 9)

I am running chef 11.4.4 on ubuntu 12.04 LTS

Do you guys have any ideas what is happening and how to solve this ?

--
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.

§