Skip to content

Commit

Permalink
Add support for custom and disabling of pidfiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
jburnham committed Nov 6, 2014
1 parent b1c0011 commit 7066392
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ If you find this module useful, send some bitcoins to 1Na3YFUmdxKxJLiuRXQYJU2kiN

* $package_ensure = 'present'
* $logfile = '/var/log/memcached.log'
* $pidfile = '/var/run/memcached.pid' (Debian family only, set to false to disable pidfile)
* $max_memory = false
* $item_size = false
* $lock_memory = false (WARNING: good if used intelligently, google for -k key)
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class memcached (
$package_ensure = 'present',
$logfile = '/var/log/memcached.log',
$pidfile = '/var/run/memcached.pid',
$manage_firewall = false,
$max_memory = false,
$item_size = false,
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/memcached_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
:install_dev => true,
:processorcount => 1
},
{
:pidfile => false,
},
{
:pidfile => '/var/log/memcached.pid',
},
{
:package_ensure => 'absent',
:install_dev => true
Expand Down Expand Up @@ -183,6 +189,9 @@
if(param_hash[:lock_memory])
expected_lines.push("-k")
end
if(param_hash[:pidfile])
expected_lines.push("-P #{param_hash[:pidfile]}")
end
if(param_hash[:verbosity])
expected_lines.push("-vvv")
end
Expand Down
6 changes: 4 additions & 2 deletions templates/memcached.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# Run memcached as a daemon.
-d

<% if @pidfile -%>
# pidfile
-P /var/run/memcached.pid
-P <%= @pidfile %>
<% end -%>

# Log memcached's output
logfile <%= @logfile -%>
Expand Down Expand Up @@ -59,4 +61,4 @@ logfile <%= @logfile -%>
<% if @auto_removal -%>
# Disable automatic removal of items from the cache when out of memory
-M
<% end -%>
<% end -%>

0 comments on commit 7066392

Please sign in to comment.