- From: Lamont Granquist <
>
- To:
- Cc: Jeff Byrnes <
>
- Subject: [chef] Re: Re: Overriding computed attributes
- Date: Mon, 19 May 2014 12:21:20 -0700
On Mon May 19 10:45:22 2014, Jeff Byrnes wrote:
Jeppe:
No, it will not. Because of how the attributes are evaluated, the
defaults will be set, then node[:foo][:ver] will be overridden. It’s
generally considered best practice, if you’re going to use attributes
to compute another attribute, to set the computed attribute in a
recipe. Here’s a nice resource for this (and other tidbits):
https://wiki.opscode.com/display/chef/Cookbook+Style+Guide+Draft#CookbookStyleGuideDraft-GeneratingData
That is way out of date.
Generally setting attributes in recipes leads to compile/converge mode
sadness, and setting attributes in recipes should be avoided
(ultimately down this road you wind up finding out why force_default
and force_override got added to Chef, but you need a few layers of
wrapping cookbooks to get there).
Using roles gets overriding computed attributes right.
Otherwise, set both of the attributes explicitly in your role cookbook.
PolicyFile in Chef 12 should help sort this out.
Archive powered by MHonArc 2.6.16.