Skip to content

Commit

Permalink
add parameter to disable service restart
Browse files Browse the repository at this point in the history
  • Loading branch information
saz committed Jun 22, 2014
1 parent 3041b16 commit 55aef26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ If you find this module useful, send some bitcoins to 1Na3YFUmdxKxJLiuRXQYJU2kiN
* $unix_socket = undef
* $install_dev = false (TRUE if 'libmemcached-dev' package should be installed)
* $processorcount = $::processorcount
* $service_restart = true (restart service after configuration changes, false to prevent restarts)
12 changes: 10 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
$verbosity = undef,
$unix_socket = undef,
$install_dev = false,
$processorcount = $::processorcount
$processorcount = $::processorcount,
$service_restart = true
) inherits memcached::params {

# validate type and convert string to boolean if necessary
Expand All @@ -27,6 +28,7 @@
$manage_firewall_bool = $manage_firewall
}
validate_bool($manage_firewall_bool)
validate_bool($service_restart)

if $package_ensure == 'absent' {
$service_ensure = 'stopped'
Expand Down Expand Up @@ -59,19 +61,25 @@
}
}

if $service_restart {
$service_notify_real = Service[$memcached::params::service_name]
} else {
$service_notify_real = undef
}

file { $memcached::params::config_file:
owner => 'root',
group => 'root',
mode => '0644',
content => template($memcached::params::config_tmpl),
require => Package[$memcached::params::package_name],
notify => $service_notify_real,
}

service { $memcached::params::service_name:
ensure => $service_ensure,
enable => true,
hasrestart => true,
hasstatus => $memcached::params::service_hasstatus,
subscribe => File[$memcached::params::config_file],
}
}

0 comments on commit 55aef26

Please sign in to comment.