Blame SOURCES/bz1745713-rabbitmq-cluster-7-suppress-additional-output.patch

b4b3ce
From 5a33171b2c40e2e1587e82aad0cb7e39abcf615d Mon Sep 17 00:00:00 2001
b4b3ce
From: John Eckersberg <jeckersb@redhat.com>
b4b3ce
Date: Thu, 13 Dec 2018 12:58:43 -0500
b4b3ce
Subject: [PATCH] rabbitmq-cluster: always use quiet flag for eval calls
b4b3ce
b4b3ce
On older rabbitmq versions, rabbitmqctl appends "...done." at the end
b4b3ce
of the output.  However we expect eval without this extra output so it
b4b3ce
can be used for further processing.  The -q option to rabbitmqctl
b4b3ce
suppresses the extra output, so ensure we always pass that when
b4b3ce
calling eval.
b4b3ce
b4b3ce
Resolves: RHBZ#1659072
b4b3ce
---
b4b3ce
 heartbeat/rabbitmq-cluster | 15 ++++++++-------
b4b3ce
 1 file changed, 8 insertions(+), 7 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
b4b3ce
index 2dca3e216..e82ac2399 100755
b4b3ce
--- a/heartbeat/rabbitmq-cluster
b4b3ce
+++ b/heartbeat/rabbitmq-cluster
b4b3ce
@@ -39,6 +39,7 @@ RMQ_TRY_RESTART_ERROR_CODE=126
b4b3ce
 
b4b3ce
 RMQ_SERVER=/usr/sbin/rabbitmq-server
b4b3ce
 RMQ_CTL=/usr/sbin/rabbitmqctl
b4b3ce
+RMQ_EVAL="${RMQ_CTL} eval -q"
b4b3ce
 RMQ_DATA_DIR="/var/lib/rabbitmq/mnesia"
b4b3ce
 RMQ_PID_DIR="/var/run/rabbitmq"
b4b3ce
 RMQ_PID_FILE="/var/run/rabbitmq/rmq.pid"
b4b3ce
@@ -179,7 +180,7 @@ remove_pid () {
b4b3ce
 }
b4b3ce
 
b4b3ce
 rmq_app_running() {
b4b3ce
-	if $RMQ_CTL eval 'application:which_applications().' | grep -q '{rabbit,'; then
b4b3ce
+	if $RMQ_EVAL 'application:which_applications().' | grep -q '{rabbit,'; then
b4b3ce
 		ocf_log debug "RabbitMQ application is running"
b4b3ce
 		return $OCF_SUCCESS
b4b3ce
 	else
b4b3ce
@@ -190,7 +191,7 @@ rmq_app_running() {
b4b3ce
 }
b4b3ce
 
b4b3ce
 rmq_node_alive() {
b4b3ce
-	if $RMQ_CTL eval 'ok.'; then
b4b3ce
+	if $RMQ_EVAL 'ok.'; then
b4b3ce
 		ocf_log debug "RabbitMQ node is alive"
b4b3ce
 		return $OCF_SUCCESS
b4b3ce
 	else
b4b3ce
@@ -203,11 +204,11 @@ rmq_node_alive() {
b4b3ce
 rmq_monitor() {
b4b3ce
 	local rc
b4b3ce
 
b4b3ce
-	status=$($RMQ_CTL eval 'rabbit_mnesia:cluster_status_from_mnesia().' 2>&1)
b4b3ce
+	status=$($RMQ_EVAL 'rabbit_mnesia:cluster_status_from_mnesia().' 2>&1)
b4b3ce
 	if echo "${status}" | grep -q '^{ok'; then
b4b3ce
 		pcs_running=$(rmq_join_list | wc -w)
b4b3ce
 		ocf_log debug "Pacemaker thinks ${pcs_running} RabbitMQ nodes are running"
b4b3ce
-		rmq_running=$($RMQ_CTL eval 'length(mnesia:system_info(running_db_nodes)).')
b4b3ce
+		rmq_running=$($RMQ_EVAL 'length(mnesia:system_info(running_db_nodes)).')
b4b3ce
 		ocf_log debug "RabbitMQ thinks ${rmq_running} RabbitMQ nodes are running"
b4b3ce
 
b4b3ce
 		if [ $(( $rmq_running * 2 )) -lt $pcs_running ]; then
b4b3ce
@@ -294,7 +295,7 @@ rmq_start_first()
b4b3ce
 
b4b3ce
 rmq_is_clustered()
b4b3ce
 {
b4b3ce
-    $RMQ_CTL eval 'rabbit_mnesia:is_clustered().' | grep -q true
b4b3ce
+    $RMQ_EVAL 'rabbit_mnesia:is_clustered().' | grep -q true
b4b3ce
 }
b4b3ce
 
b4b3ce
 rmq_join_existing()
b4b3ce
@@ -432,7 +433,7 @@ rmq_try_start() {
b4b3ce
 
b4b3ce
 	# Restore users, user permissions, and policies (if any)
b4b3ce
 	BaseDataDir=`dirname $RMQ_DATA_DIR`
b4b3ce
-	$RMQ_CTL eval "
b4b3ce
+	$RMQ_EVAL "
b4b3ce
 		%% Run only if Mnesia is ready.
b4b3ce
 		lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
b4b3ce
 		begin
b4b3ce
@@ -497,7 +498,7 @@ rmq_start() {
b4b3ce
 rmq_stop() {
b4b3ce
 	# Backup users, user permissions, and policies
b4b3ce
 	BaseDataDir=`dirname $RMQ_DATA_DIR`
b4b3ce
-	$RMQ_CTL eval "
b4b3ce
+	$RMQ_EVAL "
b4b3ce
 		%% Run only if Mnesia is still available.
b4b3ce
 		lists:any(fun({mnesia,_,_}) -> true; ({_,_,_}) -> false end, application:which_applications()) andalso
b4b3ce
 		begin