Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow alternate restart command #249

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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].
#
Expand Down Expand Up @@ -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$' ],
Expand Down
17 changes: 11 additions & 6 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down