[chef] Re: Injecting a resource into another cookbook's recipe


Chronological Thread 
  • From: "steve ." < >
  • To:
  • Subject: [chef] Re: Injecting a resource into another cookbook's recipe
  • Date: Mon, 15 Apr 2013 11:43:34 -0700

I've run defines and used LWRPs in other recipes -- seems to work, as long as the defining cookbook is loaded up earlier in the run list.  However, I don't like the idea of leaving it up to the user to figure out whether or not they need to add some_random_cookbook to a run list, so I've adopted the pattern of "include_recipe 'some_random_cookbook::default'" and simply not putting anything of substance in a default recipe that isn't required across the entire cookbook.


On Thu, Apr 11, 2013 at 12:07 PM, Kevin Nuckolls < " target="_blank"> > wrote:
Since it's ruby, I assume it's possible to have a resource run within another scope as defined at runtime. I basically ran into a situation where I defined a variable that I used to inject information in a template in a library cookbook, then found that I also wanted access to that variable from the wrapper cookbook.

I could probably put it in a library, but at this point I'm just curious if anyone has done this. Can you run a resource in another cookbook's recipe if you even wanted to?

Not saying this is the correct way to do it, just curious if it's actually possible.

-Kevin




Archive powered by MHonArc 2.6.16.

§