Skip to content

Instantly share code, notes, and snippets.

@amaltson
Last active August 29, 2015 14:19
Show Gist options
  • Save amaltson/f92596148d1406d194ad to your computer and use it in GitHub Desktop.
Save amaltson/f92596148d1406d194ad to your computer and use it in GitHub Desktop.
Attribute precedence
...
suites:
- name: default
run_list:
...
attributes:
otpp_redis:
primary:
search_criteria: 'run_list:recipe[otpp_redis::primary]'
# attributes/default.rb
...
puts "Primary attribute computed: #{node['otpp_redis']['primary']}"
default['otpp_redis']['primary']['address'] = 'Chef search will override'
default['otpp_redis']['primary']['port'] = '6379'
default['otpp_redis']['primary']['search_criteria'] = 'To be overriden in wrapper cookbooks'
puts "Primary attribute default: #{node.default['otpp_redis']['primary']}"
puts "Primary attribute normal: #{node.normal['otpp_redis']['primary']}"
puts "Primary attribute computed: #{node['otpp_redis']['primary']}"
...
Primary attribute computed: {"search_criteria"=>"run_list:recipe[otpp_redis::primary]"}
Primary attribute default: {"address"=>"Chef search will override", "port"=>"6379", "search_criteria"=>"To be overriden in wrapper cookbooks"}
Primary attribute normal: {"search_criteria"=>"run_list:recipe[otpp_redis::primary]"}
Primary attribute computed: {"search_criteria"=>"run_list:recipe[otpp_redis::primary]"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment