Skip to content

Instantly share code, notes, and snippets.

@Sauraus
Created August 12, 2013 17:53
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 Sauraus/6213282 to your computer and use it in GitHub Desktop.
Save Sauraus/6213282 to your computer and use it in GitHub Desktop.
Why is the :port not merged into the params hash for the definition?
define :memcached_instance do
include_recipe "runit"
include_recipe "memcached"
opts = params
runit_service "memcached-#{params[:name]}" do
run_template_name "memcached"
default_logger true
cookbook "memcached"
options({
:memory => node['memcached']['memory'],
:port => node['memcached']['port'],
:listen => node['memcached']['listen'],
:maxconn => node['memcached']['maxconn'],
:user => node['memcached']['user']}.merge(opts)
)
end
end
'node' => {
'memcached' => {
:user => 'nobody',
:listen => '127.0.0.1',
'instances' => {
:obj => {
:port => '11211'
},
:chat => {
:port => '11212'
},
:grp => {
:port => '11213'
}
}
}
}
node['memcached']['instances'].each_pair do |name, options|
memcached_instance name do
params.merge(options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment