Blame SOURCES/bz1655655-ocf_log-do-not-log-debug-when-HA_debug-unset.patch

7a0b27
From aae26ca70ef910e83485778c1fb450941fe79e8a Mon Sep 17 00:00:00 2001
7a0b27
From: Michele Baldessari <michele@acksyn.org>
7a0b27
Date: Mon, 3 Dec 2018 16:48:14 +0100
7a0b27
Subject: [PATCH] Do not log at debug log level when HA_debug is unset
7a0b27
7a0b27
There might be situations (e.g. bundles) where the HA_debug variable
7a0b27
is unset. It makes little sense to enable debug logging when the HA_debug env
7a0b27
variable is unset.
7a0b27
So let's skip debug logs when HA_debug is set to 0 or is unset.
7a0b27
7a0b27
Tested inside a bundle and observed that previously seen 'ocf_log debug'
7a0b27
calls are now correctly suppressed (w/ HA_debug being unset inside the
7a0b27
container)
7a0b27
7a0b27
Signed-off-by: Michele Baldessari <michele@acksyn.org>
7a0b27
---
7a0b27
 heartbeat/ocf-shellfuncs.in | 2 +-
7a0b27
 1 file changed, 1 insertion(+), 1 deletion(-)
7a0b27
7a0b27
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
7a0b27
index 043ab9bf2..b17297e1a 100644
7a0b27
--- a/heartbeat/ocf-shellfuncs.in
7a0b27
+++ b/heartbeat/ocf-shellfuncs.in
7a0b27
@@ -257,7 +257,7 @@ ha_log()
7a0b27
 
7a0b27
 ha_debug() {
7a0b27
 
7a0b27
-        if [ "x${HA_debug}" = "x0" ] ; then
7a0b27
+        if [ "x${HA_debug}" = "x0" ] || [ -z "${HA_debug}" ] ; then
7a0b27
                 return 0
7a0b27
         fi
7a0b27
 	if tty >/dev/null; then