Blame SOURCES/bz1792196-rabbitmq-cluster-delete-nodename-when-stop-fails.patch

9cf66a
From 47d75f8de9dc912da035805f141c674885ce432f Mon Sep 17 00:00:00 2001
9cf66a
From: John Eckersberg <jeckersb@redhat.com>
9cf66a
Date: Thu, 16 Jan 2020 10:20:59 -0500
9cf66a
Subject: [PATCH] rabbitmq-cluster: ensure we delete nodename if stop action
9cf66a
 fails
9cf66a
9cf66a
If the stop action fails, we want to remove the nodename from the crm
9cf66a
attribute.  Currently it is possible for the stop action to fail but
9cf66a
the rabbitmq server does actually stop.  This leaves the attribute
9cf66a
still present.  This means if the entire rabbitmq cluster is stopped,
9cf66a
it is not possible to start the cluster again because the first node
9cf66a
to start will think there is at least one other node running.  Then
9cf66a
the node tries to join an existing cluster instead of rebootstrapping
9cf66a
the cluster from a single node.
9cf66a
---
9cf66a
 heartbeat/rabbitmq-cluster | 2 ++
9cf66a
 1 file changed, 2 insertions(+)
9cf66a
9cf66a
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
9cf66a
index 7837e9e3c..a9ebd37ad 100755
9cf66a
--- a/heartbeat/rabbitmq-cluster
9cf66a
+++ b/heartbeat/rabbitmq-cluster
9cf66a
@@ -552,6 +552,7 @@ rmq_stop() {
9cf66a
 
9cf66a
 	if [ $rc -ne 0 ]; then
9cf66a
 		ocf_log err "rabbitmq-server stop command failed: $RMQ_CTL stop, $rc"
9cf66a
+		rmq_delete_nodename
9cf66a
 		return $rc
9cf66a
 	fi
9cf66a
 
9cf66a
@@ -565,6 +566,7 @@ rmq_stop() {
9cf66a
 			break
9cf66a
 		elif [ "$rc" -ne $OCF_SUCCESS ]; then
9cf66a
 			ocf_log info "rabbitmq-server stop failed: $rc"
9cf66a
+			rmq_delete_nodename
9cf66a
 			exit $OCF_ERR_GENERIC
9cf66a
 		fi
9cf66a
 		sleep 1