From 55aef2641fa070b40c4745df009ab65ade8c2b93 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Sun, 22 Jun 2014 13:59:44 +0200 Subject: [PATCH] add parameter to disable service restart --- README.md | 1 + manifests/init.pp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fda97f5d9..3e70b51be 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/manifests/init.pp b/manifests/init.pp index 63c19e000..7f857360b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 @@ -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' @@ -59,12 +61,19 @@ } } + 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: @@ -72,6 +81,5 @@ enable => true, hasrestart => true, hasstatus => $memcached::params::service_hasstatus, - subscribe => File[$memcached::params::config_file], } }