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