[chef] Re: Re: Re: Re: When is it necessary to use include_attribute?


Chronological Thread 
  • From: Christopher Armstrong < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: When is it necessary to use include_attribute?
  • Date: Thu, 27 Mar 2014 11:51:50 -0700

Awesome, thanks


On Thu, Mar 27, 2014 at 10:12 AM, Daniel DeLeo < " target="_blank"> > wrote:
Yup. The code is here if you want to take a look: https://github.com/opscode/chef/blob/master/lib/chef/run_context/cookbook_compiler.rb#L58-93

--
Daniel DeLeo


On Thursday, March 27, 2014 at 10:10 AM, Christopher Armstrong wrote:

> Thanks Dan.
>
> So, if I depend on a cookbook in my metadata.rb, I can trust that its attributes are parsed before Chef gets to my cookbook's attributes?
>
>
> On Thu, Mar 27, 2014 at 10:09 AM, Daniel DeLeo < "> (mailto: "> )> wrote:
> >
> >
> > On Thursday, March 27, 2014 at 10:01 AM, Christopher Armstrong wrote:
> >
> > > Ohai Chefs,
> > >
> > > Say I have a cookbook bar. This cookbook depends on a cookbook foo. I have included foo as a dependency in my metadata.rb and I'm doing an include_recipe "foo" in bar's default recipe. Groovy.
> > >
> > > I need to override a few of foo's default attributes in bar. So, in bar's attributes.rb, I override these attributes.
> > >
> > > Now my question: ordinarily, I would include_attributes "foo" in bar before I override these attributes, as alphabetically foo comes after bar, and I want to ensure that those attributes are parsed before I override them.
> > >
> > > That's how I've been doing things. Today, though, I'm wondering if that's even necessary, because I have listed foo as a dependency in bar's metadata. Does Chef's dependency resolver parse default attributes for all dependencies before getting to a cookbook's own attributes?
> > >
> > > Hope that makes sense!
> > >
> > > Thanks,
> > >
> > > Chris
> > In Chef 10 it was a total mess, so we’ll skip that. But if you are still using 10.x then include attribute is definitely needed to have any semblance of sanity.
> >
> > In Chef 11, cookbooks get ordered based on dependencies, and then within a cookbook, default.rb gets loaded first and then it’s lexical (alphabetical, more or less) sort order after that.
> >
> > If you run with -ldebug, you should see log messages for your include_attributes statements that say whether they’re no-ops or not.
> >
> >
> > --
> > Daniel DeLeo
>







Archive powered by MHonArc 2.6.16.

§