[chef] Re: Chained dependencies management


Chronological Thread 
  • From: Dan Crosta < >
  • To:
  • Subject: [chef] Re: Chained dependencies management
  • Date: Thu, 9 Aug 2012 10:20:49 -0400

include_recipe actually includes (and runs) a recipe. When used in the 
shorthand form, like

    include_recipe "other_cookbook"

It runs the default recipe from that cookbook, just as including 
"recipe[other_cookbook]" in a role run_list would do. To have Chef manage 
dependencies for you, you should use the "depends" attribute in your cookbook 
metadata. For example, in metadata.rb, you would add:

    depends "other_cookbook"

(There is a similar form if you are using metadata.json directly.) Now when 
Chef runs and realizes that it needs to include your current cookbook, it 
will also include other_cookbook.

To use an LWRP from another cookbook, I don't believe you need to 
include_recipe at all (someone please correct me if I'm wrong), you just need 
to have that cookbook available on the system (which is what depends does). 
Note however that some LWRPs also expect a corresponding recipe to be run, 
either before or after -- so read the instructions from that cookbook.

- Dan


On Aug 9, 2012, at 10:00 AM, Alfredo Palhares wrote:

> Hello Chef Cookers,
> 
> I am looking for a way to manage cookbook dependencies, as our infrascture
> grows and thus the complexity too, dependencies are becoming hard to manage.
> 
> We use include_recipe in cases where we only use a lightweight resource 
> defined
> by that particular cookbook. Since include_recipe only loads the direct 
> cookbook
> and not the includes that cookbook might contains.
> 
> Why it does not do this?
> Is it a design option? 
> Or a limitation that is going to be completed in the future?
> 
> I would like to hear your opinion on this.
> 
> --
> Regards
> Alfredo Palhares




Archive powered by MHonArc 2.6.16.

§