From ccb774315056b41918c7a345194a7ddb1784a72a Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 18 Mar 2017 19:48:38 +0100 Subject: [PATCH] And clean out mptraid things if we do not have mptraid --- modules/hardware/manifests/raid.pp | 5 +--- modules/hardware/manifests/raid/raidmpt.pp | 29 ++++++++++++++-------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/modules/hardware/manifests/raid.pp b/modules/hardware/manifests/raid.pp index 3affb8983..d682c30b2 100644 --- a/modules/hardware/manifests/raid.pp +++ b/modules/hardware/manifests/raid.pp @@ -7,8 +7,5 @@ class hardware::raid { include hardware::raid::megactl } - if $::mptraid { - include hardware::raid::raidmpt - } - + include hardware::raid::raidmpt } diff --git a/modules/hardware/manifests/raid/raidmpt.pp b/modules/hardware/manifests/raid/raidmpt.pp index c512913ec..f371c7227 100644 --- a/modules/hardware/manifests/raid/raidmpt.pp +++ b/modules/hardware/manifests/raid/raidmpt.pp @@ -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, + } } } -- 2.20.1