- From: Bryan McLellan <
>
- To:
- Subject: [chef] Re: Re: Re: precedence is different, so why are values merged
- Date: Tue, 18 Sep 2012 15:22:57 -0400
Array and hash attributes of the same precedence level get merged.
On Tue, Sep 18, 2012 at 2:59 PM, bradford
<
>
wrote:
>
I am still a little confused. Perhaps someone could improve the docs
>
a bit? More clarification is needed on when merging takes place The person
>
I was talking to on IRC said he was
>
bit by the same thing. Or maybe it's just me and I am simply just
>
reading through the docs too fast.
http://wiki.opscode.com/display/chef/Attributes#Attributes-SettingAttributesattheSamePrecedenceLevel
"A common use case is to set default attributes in a cookbook's
attribute files, and also set the same default attributes, but with
different values, using a role. In this scenario, the attributes set
in the role will be deep merged on top of the attributes from the
attributes file. The attributes set by the role will win if there is a
conflict."
If an attribute that is a string of the precedence level default is
set in a cookbook and a role, the value will be that set in a role.
If that attribute is an array, the value will be the two arrays merged
together.
If that attribute is a hash, all the keys will be merged together and
the conflicting keys will be chosen from the object of a higher
precedence (the role).
>
How do the default_attributes, normal_attributes, and override_attributes
>
fit in with the precedence?
http://wiki.opscode.com/display/chef/Attributes#Attributes-Precedence
>
Is it always, unless you specify "!merge:"?
BTW, subtractive merge is not supported in Chef 11+.
Bryan
Archive powered by MHonArc 2.6.16.