From f4b539d5b6b609dbf45f144fe3321d797a05139c Mon Sep 17 00:00:00 2001 From: Andre Keller Date: Wed, 20 May 2015 14:06:23 +0200 Subject: [PATCH] feature: Add possibilty to configure no listen_ip. --- spec/classes/memcached_spec.rb | 7 ++++++- templates/memcached.conf.erb | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/classes/memcached_spec.rb b/spec/classes/memcached_spec.rb index 3357569f7..18393b8f8 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, }, @@ -172,7 +175,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]}", @@ -188,6 +190,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 %>