[chef] Nested node attributes not working as expected when using overrides?


Chronological Thread 
  • From: Torben Knerr < >
  • To:
  • Subject: [chef] Nested node attributes not working as expected when using overrides?
  • Date: Fri, 19 Oct 2012 16:43:13 +0200

Hi Chefs!

I'm often using something like this in my attributes/default.rb:

    default['my_recipe']['base_dir']  = '/path/to/basedir'
    default['my_recipe']['other_dir']  = "#{node['my_recipe']['base_dir']}/otherdir"

This looks sane at first, but as soon as I'm overriding the default value for ['my_recipe']['base_dir'], e.g.  in a role like so...

    ...
    default_attributes({
      :my_recipe => {
        :base_dir => '/somewhere/else'
      }
    })
    ...

...I get a weird behavior when using the node attributes in my recipe:

=> node['my_recipe']['base_dir'] renders to '/somewhere/else'
=> node['my_recipe']['other_dir'] renders to '/path/to/basedir/otherdir'

Is this the expected behaviour?!

Cheers,
Torben

P.S.: this was under omnibus chef 10.14.4 on a 64 bit Ubuntu 12.04



Archive powered by MHonArc 2.6.16.

§