Created
August 12, 2013 17:53
-
-
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?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'node' => { | |
'memcached' => { | |
:user => 'nobody', | |
:listen => '127.0.0.1', | |
'instances' => { | |
:obj => { | |
:port => '11211' | |
}, | |
:chat => { | |
:port => '11212' | |
}, | |
:grp => { | |
:port => '11213' | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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