From 8b9d4b7f02574ebac0b9093f81f83a90d9487b55 Mon Sep 17 00:00:00 2001 From: Tim Bishop Date: Sat, 4 Mar 2017 00:27:54 +0000 Subject: [PATCH] Allow alternate restart command. --- manifests/init.pp | 23 ++++++++++++++--------- manifests/service.pp | 17 +++++++++++------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index b92d4d877..dfefdc120 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -20,6 +20,10 @@ # If set to true the service is managed otherwise the service also # isn't restarted if a config file changed. Defaults to true. # +# [*service_restart*] +# If set this command will be used to restart the service, rather than stopping and starting it. +# Defaults to undef. +# # [*features*] # List of features to activate. Defaults to [checker, mainlog, notification]. # @@ -122,15 +126,16 @@ # # class icinga2( - $ensure = running, - $enable = true, - $manage_repo = false, - $manage_service = true, - $features = $icinga2::params::default_features, - $purge_features = true, - $constants = {}, - $plugins = $icinga2::params::plugins, - $confd = true, + $ensure = running, + $enable = true, + $manage_repo = false, + $manage_service = true, + $service_restart = undef, + $features = $icinga2::params::default_features, + $purge_features = true, + $constants = {}, + $plugins = $icinga2::params::plugins, + $confd = true, ) inherits ::icinga2::params { validate_re($ensure, [ '^running$', '^stopped$' ], diff --git a/manifests/service.pp b/manifests/service.pp index 56f0d9224..fc2c1d908 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -20,15 +20,20 @@ fail("icinga2::service is a private class of the module icinga2, you're not permitted to use it.") } - $ensure = $::icinga2::ensure - $enable = $::icinga2::enable - $manage_service = $::icinga2::manage_service - $service = $::icinga2::params::service + $ensure = $::icinga2::ensure + $enable = $::icinga2::enable + $manage_service = $::icinga2::manage_service + $service = $::icinga2::params::service + $service_restart = $::icinga2::service_restart + + $service_hasrestart = $service_restart == undef if $manage_service { service { $service: - ensure => $ensure, - enable => $enable, + ensure => $ensure, + enable => $enable, + restart => $service_restart, + hasrestart => $service_hasrestart, } }