- From: Adam Jacob <
>
- To:
- Subject: [chef] Re: Default attributes are merging
- Date: Tue, 4 Oct 2011 10:43:06 -0700
If they are at the same precedence level, they get deep merged
together. Use precedence to override the value entirely.
Adam
On Tue, Oct 4, 2011 at 6:25 AM, Geoff Meakin Acid
<
>
wrote:
>
Hi all,
>
>
I've tried to set up a bind DNS server using chef.
>
>
My bind cookbook has the following default attributes:
>
(cookbooks/bind/attributes/default.rb)
>
default[:bind][:upstream_servers] = ['8.8.8.8','8.8.4.4'] # e.g. the
>
google DNS servers
>
>
However in my "production" environment file, I change them thus:
>
(environments/production.rb)
>
default_attributes({ "bind" => { "upstream_servers" => [ "xxx.xxx.xxx.xxx",
>
"yyy.yyy.yyy.yyy" ] })
>
>
When my template gets written however, I get all four values printed:
>
forwarders {
>
8.8.8.8;
>
8.8.4.4;
>
xxx.xxx.xxx.xxx;
>
yyy.yyy.yyy.yyy;
>
};
>
>
Have I misunderstood the way attributes get overwritten? I thought from
>
this wiki page, the environment attributes OVERRIDE the cookbook attributes
>
http://wiki.opscode.com/display/chef/Attributes
>
>
I know I can obviously use override_attributes rather than
>
default_attributes… but I didn't expect this to happen anyway
>
>
Thanks!
>
Geoff
>
>
--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E:
Archive powered by MHonArc 2.6.16.