Skip to content

Commit

Permalink
Don't manage the smartd service when ensure => absent
Browse files Browse the repository at this point in the history
If the smartd package is not installed, puppet will attempt to stop
a service that doesn't exist. For this reason, the smartd service should
not be managed if ensure is set to absent or purged.
If smartd is getting uninstalled, the deb script will take care to stop
the service anyway.
  • Loading branch information
queeno committed Jun 12, 2015
1 parent 8e0f4bc commit d5ce6ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
# `Bool`
#
# State whether or not this puppet module should manage the service.
# This parameter is disregarded when $ensure = absent|purge.
#
# defaults to: `true`
#
Expand Down Expand Up @@ -138,12 +139,14 @@
$svc_ensure = $service_ensure
$svc_enable = $service_ensure ? { 'running' => true, 'stopped' => false }
$file_ensure = 'present'
$srv_manage = $manage_service
}
'absent', 'purged': {
$pkg_ensure = $ensure
$svc_ensure = 'stopped'
$svc_enable = false
$file_ensure = 'absent'
$srv_manage = false
}
default: {
fail("unsupported value of \$ensure: ${ensure}")
Expand All @@ -154,7 +157,7 @@
ensure => $pkg_ensure,
}

if $manage_service {
if $srv_manage {
service { $service_name:
ensure => $svc_ensure,
enable => $svc_enable,
Expand Down

0 comments on commit d5ce6ce

Please sign in to comment.