And clean out mptraid things if we do not have mptraid
authorPeter Palfrader <peter@palfrader.org>
Sat, 18 Mar 2017 18:48:38 +0000 (19:48 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sat, 18 Mar 2017 19:13:54 +0000 (20:13 +0100)
modules/hardware/manifests/raid.pp
modules/hardware/manifests/raid/raidmpt.pp

index 3affb89..d682c30 100644 (file)
@@ -7,8 +7,5 @@ class hardware::raid {
                include hardware::raid::megactl
        }
 
-       if $::mptraid {
-               include hardware::raid::raidmpt
-       }
-
+       include hardware::raid::raidmpt
 }
index c512913..f371c72 100644 (file)
@@ -7,18 +7,27 @@
 #   include hardware::raid::raidmpt
 #
 class hardware::raid::raidmpt {
+       if $::mptraid {
+               package { 'mpt-status':
+                       ensure => installed
+               }
 
-       package { 'mpt-status':
-               ensure => installed
-       }
+               file { '/etc/default/mpt-statusd':
+                       content => "# This file is under puppet control\nRUN_DAEMON=no\n",
+                       notify  => Exec['mpt-statusd-stop'],
+               }
 
-       file { '/etc/default/mpt-statusd':
-               content => "# This file is under puppet control\nRUN_DAEMON=no\n",
-               notify  => Exec['mpt-statusd-stop'],
-       }
+               exec { 'mpt-statusd-stop':
+                       command => 'pidfile=/var/run/mpt-statusd.pid; ! [ -e "$pidfile" ] || /sbin/start-stop-daemon --oknodo --stop --signal TERM --quiet --pidfile "$pidfile"; rm -f "$pidfile";  pkill -INT  -P 1 -u 0 -f "/usr/bin/daemon /etc/init.d/mpt-statusd check_mpt"',
+                       refreshonly => true,
+               }
+       } else {
+               package { 'mpt-status':
+                       ensure => purged,
+               }
 
-       exec { 'mpt-statusd-stop':
-               command => 'pidfile=/var/run/mpt-statusd.pid; ! [ -e "$pidfile" ] || /sbin/start-stop-daemon --oknodo --stop --signal TERM --quiet --pidfile "$pidfile"; rm -f "$pidfile";  pkill -INT  -P 1 -u 0 -f "/usr/bin/daemon /etc/init.d/mpt-statusd check_mpt"',
-               refreshonly => true,
+               file { '/etc/default/mpt-statusd':
+                       ensure => absent,
+               }
        }
 }