Blame SOURCES/bz1659072-2-rabbitmq-cluster-suppress-additional-output.patch

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