Blame SOURCES/bz2021125-gcp-ilb-2-only-check-log_cmd-if-log-enabled.patch

871fe5
From 14576f7ca02fb0abff188238ac019e88ab06e878 Mon Sep 17 00:00:00 2001
871fe5
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
871fe5
Date: Tue, 9 Nov 2021 11:49:36 +0100
871fe5
Subject: [PATCH] gcp-ilb: only check if log_cmd binary is available if
871fe5
 log_enable is true
871fe5
871fe5
---
871fe5
 heartbeat/gcp-ilb | 9 +++++----
871fe5
 1 file changed, 5 insertions(+), 4 deletions(-)
871fe5
871fe5
diff --git a/heartbeat/gcp-ilb b/heartbeat/gcp-ilb
871fe5
index 48dc3ac4e..f84f373b7 100755
871fe5
--- a/heartbeat/gcp-ilb
871fe5
+++ b/heartbeat/gcp-ilb
871fe5
@@ -37,7 +37,7 @@ if  type "socat" > /dev/null 2>&1; then
871fe5
 	OCF_RESKEY_cat_default="socat"
871fe5
 else 
871fe5
 	OCF_RESKEY_cat_default="nc"
871fe5
-fi;
871fe5
+fi
871fe5
 
871fe5
 
871fe5
 : ${OCF_RESKEY_cat=${OCF_RESKEY_cat_default}}
871fe5
@@ -53,7 +53,7 @@ pidfile="/var/run/$OCF_RESOURCE_INSTANCE.pid"
871fe5
 
871fe5
 
871fe5
 #Validate command for logging
871fe5
-if [ $OCF_RESKEY_log_enable = "true" ]; then
871fe5
+if ocf_is_true "$OCF_RESKEY_log_enable"; then
871fe5
     if  type $OCF_RESKEY_log_cmd > /dev/null 2>&1; then
871fe5
 	logging_cmd="$OCF_RESKEY_log_cmd $OCF_RESKEY_log_params"
871fe5
 	ocf_log debug "Logging command is: \'$logging_cmd\' "
871fe5
@@ -61,7 +61,7 @@ if [ $OCF_RESKEY_log_enable = "true" ]; then
871fe5
 	OCF_RESKEY_log_enable="false"
871fe5
 	ocf_log err "\'$logging_cmd\' is invalid. External logging disabled."
871fe5
 		
871fe5
-    fi;
871fe5
+    fi
871fe5
 fi
871fe5
 
871fe5
 
871fe5
@@ -285,7 +285,8 @@ ilb_stop() {
871fe5
 
871fe5
 ilb_validate() {
871fe5
 	check_binary "$OCF_RESKEY_cat"
871fe5
-	check_binary "$OCF_RESKEY_log_cmd"
871fe5
+
871fe5
+	ocf_is_true "$OCF_RESKEY_log_enable" && check_binary "$OCF_RESKEY_log_cmd"
871fe5
 
871fe5
 	if ! ocf_is_decimal "$OCF_RESKEY_port"; then
871fe5
 		ocf_exit_reason "$OCF_RESKEY_port is not a valid port"