File pacemaker#3289-0001-Fix-HealthSmart-Check-the-parameter-values-of-check_.patch of Package pacemaker.38493
From cccff82fef715b94d9b9c1f988e65c52184f1436 Mon Sep 17 00:00:00 2001
From: bixiaoyan1 <bixiaoyan@kylinos.cn>
Date: Tue, 12 Dec 2023 14:15:32 +0800
Subject: [PATCH] Fix: HealthSmart: Check the parameter values of
check_temperature to avoid error output
---
extra/resources/HealthSMART.in | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
Index: pacemaker-2.1.5+20221208.a3f44794f/extra/resources/HealthSMART.in
===================================================================
--- pacemaker-2.1.5+20221208.a3f44794f.orig/extra/resources/HealthSMART.in
+++ pacemaker-2.1.5+20221208.a3f44794f/extra/resources/HealthSMART.in
@@ -137,28 +137,30 @@ END
check_temperature() {
- if [ $1 -lt ${lower_red_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
- attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
-
- if [ $1 -gt ${upper_red_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C"
- attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
-
- if [ $1 -lt ${lower_yellow_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
- attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}"
- return 1
- fi
-
- if [ $1 -gt ${upper_yellow_limit} ] ; then
- ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
- attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}"
- return 1
+ if [ -n "$1" ]; then
+ if [ $1 -lt ${lower_red_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C"
+ attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
+
+ if [ $1 -gt ${upper_red_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C"
+ attrd_updater -n "#health-smart" -B "red" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
+
+ if [ $1 -lt ${lower_yellow_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C"
+ attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
+
+ if [ $1 -gt ${upper_yellow_limit} ] ; then
+ ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C"
+ attrd_updater -n "#health-smart" -B "yellow" -d "${OCF_RESKEY_dampen}"
+ return 1
+ fi
fi
}