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

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