Blame SOURCES/bz1746266-docker-3-fix-stop-return-code.patch

bafc1b
From 3d52ec553fc3de82e1d1dcbef949882947915c49 Mon Sep 17 00:00:00 2001
bafc1b
From: Michele Baldessari <michele@acksyn.org>
bafc1b
Date: Thu, 29 Aug 2019 08:10:57 +0200
bafc1b
Subject: [PATCH] Fixup docker_stop condition on error
bafc1b
bafc1b
In docker_stop() let's store the return code of docker_simple_status
bafc1b
otherwise the second branch of the elif risks reflecting the return
bafc1b
code of the previous operaiton and not of docker_simple_status()
bafc1b
bafc1b
Retested this with a bunch of stop/start commands on a rabbitmq bundle
bafc1b
and observed no issues.
bafc1b
bafc1b
This fixes a stop() regression introduced in
bafc1b
b7ae1bfbe7d393a9e9d993da3da35cc4d1bc9eb4 ("Make the check for the docker
bafc1b
daemon being up more robust")
bafc1b
bafc1b
Thanks to Kota Akatsuka for spotting it.
bafc1b
bafc1b
Signed-off-by: Michele Baldessari <michele@acksyn.org>
bafc1b
---
bafc1b
 heartbeat/docker | 5 +++--
bafc1b
 1 file changed, 3 insertions(+), 2 deletions(-)
bafc1b
bafc1b
diff --git a/heartbeat/docker b/heartbeat/docker
bafc1b
index 7c587b962..41ac42129 100755
bafc1b
--- a/heartbeat/docker
bafc1b
+++ b/heartbeat/docker
bafc1b
@@ -450,10 +450,11 @@ docker_stop()
bafc1b
 {
bafc1b
 	local timeout=60
bafc1b
 	docker_simple_status
bafc1b
-	if [ $? -eq $OCF_NOT_RUNNING ]; then
bafc1b
+	ret=$?
bafc1b
+	if [ $ret -eq $OCF_NOT_RUNNING ]; then
bafc1b
 		remove_container
bafc1b
 		return $OCF_SUCCESS
bafc1b
-        elif [ $? -eq $OCF_ERR_GENERIC ]; then
bafc1b
+        elif [ $ret -eq $OCF_ERR_GENERIC ]; then
bafc1b
                return $OCF_ERR_GENERIC
bafc1b
 	fi
bafc1b