diff --git a/spec/classes/memcached_spec.rb b/spec/classes/memcached_spec.rb index c2a836da4..d8f2981c8 100644 --- a/spec/classes/memcached_spec.rb +++ b/spec/classes/memcached_spec.rb @@ -96,6 +96,9 @@ :install_dev => true, :processorcount => 1 }, + { + :listen_ip => '', + }, { :pidfile => false, }, @@ -177,7 +180,6 @@ ) expected_lines = [ "logfile #{param_hash[:logfile]}", - "-l #{param_hash[:listen_ip]}", "-p #{param_hash[:tcp_port]}", "-U #{param_hash[:udp_port]}", "-u #{param_hash[:user]}", @@ -193,6 +195,9 @@ else expected_lines.push("-m 950") end + if(param_hash[:listen_ip] != '') + expected_lines.push("-l #{param_hash[:listen_ip]}") + end if(param_hash[:lock_memory]) expected_lines.push("-k") end diff --git a/templates/memcached.conf.erb b/templates/memcached.conf.erb index 1586d9426..0dae0bcf7 100644 --- a/templates/memcached.conf.erb +++ b/templates/memcached.conf.erb @@ -34,8 +34,11 @@ logfile <%= @logfile -%> # UNIX socket path to listen on -s <%= @unix_socket %> <% else -%> + +<% if @listen_ip != '' -%> # IP to listen on -l <%= @listen_ip %> +<% end -%> # TCP port to listen on -p <%= @tcp_port %>