Automatic Run of a Dependency Cookbook's Default Recipe


#1

Hi,

The Chef Wiki states that:

“listing a cookbook as a dependency in metadata.rb will automatically run that
cookbook’s default recipe (if it exists), even if this is the only place the
cookbook is referenced.”

(http://wiki.opscode.com/display/chef/Metadata#Metadata-depends)

Yet, this wasn’t the behaviour I observed in tests I ran: if I only referenced
a cookbook as a dependency in metadata.rb, no recipe from it would ever run.

Does that mean the Chef wiki description is obsolete? IMHO, things are saner
that way (with no default recipe being run), but I’d like to make sure they’re
going to stay that way :slight_smile:

Would someone please be able to confirm this?

Cheers,

d.


#2

On 27 Jan 2012, at 11:42, Dominique Poulain wrote:

Hi,

The Chef Wiki states that:

“listing a cookbook as a dependency in metadata.rb will automatically run that
cookbook’s default recipe (if it exists), even if this is the only place the
cookbook is referenced.”

(http://wiki.opscode.com/display/chef/Metadata#Metadata-depends)

Yet, this wasn’t the behaviour I observed in tests I ran: if I only referenced
a cookbook as a dependency in metadata.rb, no recipe from it would ever run.

Does that mean the Chef wiki description is obsolete? IMHO, things are saner
that way (with no default recipe being run), but I’d like to make sure they’re
going to stay that way :slight_smile:

Would someone please be able to confirm this?

Cheers,

d.

Yes, this is incorrect. Putting the cookbook in the metadata as a dep just means that the cookbook is available on the node for use with cookbook_file, include_recipe, et al.

-ash


#3

I think X depends Y directive in the metadata sections ensure that the
cookbook X is downloaded whenever you assign a recipe from Y cookbook.
While include_recipe “X” or incluede_recipe "X::ultimate_recipe_foo"
actually invokes the recipe

On Fri, Jan 27, 2012 at 5:12 PM, Dominique Poulain dpoulain@acm.org wrote:

Hi,

The Chef Wiki states that:

“listing a cookbook as a dependency in metadata.rb will automatically run
that
cookbook’s default recipe (if it exists), even if this is the only place
the
cookbook is referenced.”

(http://wiki.opscode.com/display/chef/Metadata#Metadata-depends)

Yet, this wasn’t the behaviour I observed in tests I ran: if I only
referenced
a cookbook as a dependency in metadata.rb, no recipe from it would ever
run.

Does that mean the Chef wiki description is obsolete? IMHO, things are
saner
that way (with no default recipe being run), but I’d like to make sure
they’re
going to stay that way :slight_smile:

Would someone please be able to confirm this?

Cheers,

d.