[chef] Default attributes are merging


Chronological Thread 
  • From: Geoff Meakin Acid < >
  • To:
  • Subject: [chef] Default attributes are merging
  • Date: Tue, 4 Oct 2011 14:25:10 +0100

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




Archive powered by MHonArc 2.6.16.

§