Skip to content

Instantly share code, notes, and snippets.

@tigris
Created July 26, 2012 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tigris/e8d1f9769485d8685f9d to your computer and use it in GitHub Desktop.
Save tigris/e8d1f9769485d8685f9d to your computer and use it in GitHub Desktop.
Default precedence
# main/attributes/default.rb
default['foo'] = 'foo'
# main/attributes/other.rb
include_attribute 'main::default'
default['foo'] = 'bar'
# main/recipes/default.rb
Chef::Log.info "#### #{node['foo']}"
# main/recipes/other.rb
Chef::Log.info "#### #{node['foo']}"
{ "run_list": "recipe[main::other]" }
@tigris
Copy link
Author

tigris commented Jul 26, 2012

For whatever reason, the results are random. Have fun 40 times, got 'foo' logged out 24 times and 'bar' logged out the other 16 times.

@tigris
Copy link
Author

tigris commented Jul 26, 2012

Amazingly, it does not matter if run_list is set to main::other or main::default. You get the random foo/bar issue regardless, even though when running main::default, i would not expect it to ever even load the main/attributes/other.rb file!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment