Blame SOURCES/bz1920698-podman-return-not-running-probe.patch

0c4b27
From 6877b20a83cb691884996bf77385259388fdebb2 Mon Sep 17 00:00:00 2001
0c4b27
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
0c4b27
Date: Wed, 3 Mar 2021 17:06:12 +0100
0c4b27
Subject: [PATCH] podman: return OCF_NOT_RUNNING when monitor cmd fails (not
0c4b27
 running)
0c4b27
0c4b27
---
0c4b27
 heartbeat/podman | 21 +++++++++++++--------
0c4b27
 1 file changed, 13 insertions(+), 8 deletions(-)
0c4b27
0c4b27
diff --git a/heartbeat/podman b/heartbeat/podman
0c4b27
index 82ea14624..5b707f3f5 100755
0c4b27
--- a/heartbeat/podman
0c4b27
+++ b/heartbeat/podman
0c4b27
@@ -204,14 +204,19 @@ monitor_cmd_exec()
0c4b27
 	# 125: no container with name or ID ${CONTAINER} found
0c4b27
 	# 126: container state improper (not running)
0c4b27
 	# 127: any other error
0c4b27
-	if [ $rc -eq 125 ] || [ $rc -eq 126 ]; then
0c4b27
-		rc=$OCF_NOT_RUNNING
0c4b27
-	elif [ $rc -ne 0 ]; then
0c4b27
-		ocf_exit_reason "monitor cmd failed (rc=$rc), output: $out"
0c4b27
-		rc=$OCF_ERR_GENERIC
0c4b27
-	else
0c4b27
-		ocf_log debug "monitor cmd passed: exit code = $rc"
0c4b27
-	fi
0c4b27
+	# 255: podman 2+: container not running
0c4b27
+	case "$rc" in
0c4b27
+		125|126|255)
0c4b27
+			rc=$OCF_NOT_RUNNING
0c4b27
+			;;
0c4b27
+		0)
0c4b27
+			ocf_log debug "monitor cmd passed: exit code = $rc"
0c4b27
+			;;
0c4b27
+		*)
0c4b27
+			ocf_exit_reason "monitor cmd failed (rc=$rc), output: $out"
0c4b27
+			rc=$OCF_ERR_GENERIC
0c4b27
+			;;
0c4b27
+	esac
0c4b27
 
0c4b27
 	return $rc
0c4b27
 }