File pacemaker#3289-0001-Fix-HealthSmart-Check-the-parameter-values-of-check_.patch of Package pacemaker
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
---
agents/ocf/HealthSMART.in | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/agents/ocf/HealthSMART.in b/agents/ocf/HealthSMART.in
index 95c2e253e..0871ab91a 100755
--- a/agents/ocf/HealthSMART.in
+++ b/agents/ocf/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 [ -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 -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 -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 [ $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
}
--
2.35.3