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

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