File 0011-Low-ocf-shellfuncs-Avoid-printing-empty-INFO-message.patch of Package resource-agents.10310
From 6e4bba45cd7e46d9f4f6119be73f7b5b74ff7d47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se>
Date: Mon, 28 Aug 2017 09:23:38 +0200
Subject: [PATCH 11/13] Low: ocf-shellfuncs: Avoid printing empty INFO messages
(bsc#1053621)
When monitoring a pgsql database using `ocf:heartbeat:pgsql`,
each monitor produces two empty INFO messages in the ha logfile.
This is caused by a broken ocf_run in
`/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs` which runs:
```
output=`echo "$output" | tr -s ' \t\r\n' ' '`
```
This causes output always being `' '`, even if the called
command has no output.
The following two tests for `! -z "$output"` are broken
and causes these empty messages to appear.
Proposed fix is to only run the tr command if `$output`
actually has content.
---
heartbeat/ocf-shellfuncs.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
index 4a74e201..adb19576 100644
--- a/heartbeat/ocf-shellfuncs.in
+++ b/heartbeat/ocf-shellfuncs.in
@@ -433,7 +433,7 @@ ocf_run() {
output=`"$@" 2>&1`
rc=$?
- output=`echo "$output" | tr -s ' \t\r\n' ' '`
+ [ -n "$output" ] && output="$(echo "$output" | tr -s ' \t\r\n' ' ')"
if [ $rc -eq 0 ]; then
if [ "$verbose" -a ! -z "$output" ]; then
ocf_log info "$output"
--
2.14.1