Skip to content

Instantly share code, notes, and snippets.

@tfitch
Last active August 29, 2015 14:05
Show Gist options
  • Save tfitch/e431ebf5ada7da119767 to your computer and use it in GitHub Desktop.
Save tfitch/e431ebf5ada7da119767 to your computer and use it in GitHub Desktop.
Name/value pairs from cookbook attributes to dynamic resource attributes
# attributes for the iis_pool
default['config']['setting']['runtime_version'] = '12'
default['config']['setting']['thirty_two_bit'] = false
default['config']['setting']['max_proc'] = 4
# same result as hardcoded-recipe.rb but now driven by Attributes
iis_pool 'MyAppPool' do
node['config']['setting'].each do |setting, value|
send(setting, value)
end
action :config
end
# outputs the same as hardcoded-recipe.rb but does *not* work
iis_pool 'MyAppPool' do
node['config']['setting'].each do |setting, value|
"#{setting}" "#{value}"
end
action :config
end
# if nothing was dynamic
iis_pool 'MyAppPool' do
runtime_version '12'
max_proc 4
thirty_two_bit false
action :config
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment