Blame SOURCES/bz1746266-docker-1-fail-gracefully-when-not-running.patch

bafc1b
From 5941b98140b09e39b4dc2ee155817b287ef32859 Mon Sep 17 00:00:00 2001
bafc1b
From: zaenk <peter.pribula@hotmail.com>
bafc1b
Date: Thu, 16 May 2019 15:01:43 +0200
bafc1b
Subject: [PATCH 1/2] Fails docker RA gracefully when command not found Fails
bafc1b
 gracefully when daemon not running
bafc1b
bafc1b
---
bafc1b
 heartbeat/docker | 25 +++++++++++++++++++++++++
bafc1b
 1 file changed, 25 insertions(+)
bafc1b
bafc1b
diff --git a/heartbeat/docker b/heartbeat/docker
bafc1b
index c206344ad..1942b8f2f 100755
bafc1b
--- a/heartbeat/docker
bafc1b
+++ b/heartbeat/docker
bafc1b
@@ -33,6 +33,11 @@
bafc1b
 : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
bafc1b
 . ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
bafc1b
 
bafc1b
+# Parameter defaults
bafc1b
+
bafc1b
+OCF_RESKEY_daemon_pidfile_default="/var/run/docker.pid"
bafc1b
+: ${OCF_RESKEY_daemon_pidfile=${OCF_RESKEY_daemon_pidfile_default}}
bafc1b
+
bafc1b
 #######################################################################
bafc1b
 
bafc1b
 meta_data()
bafc1b
@@ -176,6 +181,16 @@ container to be considered healthy.
bafc1b
 <content type="boolean"/>
bafc1b
 </parameter>
bafc1b
 
bafc1b
+<parameters>
bafc1b
+<parameter name="daemon_pidfile" required="0" unique="0">
bafc1b
+<longdesc lang="en">
bafc1b
+The RA will report not running status on hosts where the docker daemon
bafc1b
+is not running.
bafc1b
+</longdesc>
bafc1b
+<shortdesc lang="en">Name of the docker daemon pid file</shortdesc>
bafc1b
+<content type="string" default="${OCF_RESKEY_daemon_pidfile_default}"/>
bafc1b
+</parameter>
bafc1b
+
bafc1b
 </parameters>
bafc1b
 
bafc1b
 <actions>
bafc1b
@@ -277,6 +292,16 @@ docker_simple_status()
bafc1b
 {
bafc1b
 	local val
bafc1b
 
bafc1b
+	if [ ! -x "$(command -v docker)" ]; then 
bafc1b
+		ocf_log err "docker is not installed on this host"
bafc1b
+		return $OCF_ERR_INSTALLED
bafc1b
+	fi
bafc1b
+
bafc1b
+	if [ ! -e "$OCF_RESKEY_daemon_pidfile" ]; then
bafc1b
+		ocf_log err "docker daemon is not running, pid file $OCF_RESKEY_daemon_pidfile not exists"
bafc1b
+		return $OCF_NOT_RUNNING
bafc1b
+	fi
bafc1b
+
bafc1b
 	container_exists
bafc1b
 	if [ $? -ne 0 ]; then
bafc1b
 		return $OCF_NOT_RUNNING
bafc1b
bafc1b
From dca670318452a4666984b2087ea562987d7c5b4f Mon Sep 17 00:00:00 2001
bafc1b
From: zaenk <peter.pribula@hotmail.com>
bafc1b
Date: Thu, 16 May 2019 15:46:28 +0200
bafc1b
Subject: [PATCH 2/2] Fixes parameter meta-data
bafc1b
bafc1b
---
bafc1b
 heartbeat/docker | 1 -
bafc1b
 1 file changed, 1 deletion(-)
bafc1b
bafc1b
diff --git a/heartbeat/docker b/heartbeat/docker
bafc1b
index 1942b8f2f..250714613 100755
bafc1b
--- a/heartbeat/docker
bafc1b
+++ b/heartbeat/docker
bafc1b
@@ -181,7 +181,6 @@ container to be considered healthy.
bafc1b
 <content type="boolean"/>
bafc1b
 </parameter>
bafc1b
 
bafc1b
-<parameters>
bafc1b
 <parameter name="daemon_pidfile" required="0" unique="0">
bafc1b
 <longdesc lang="en">
bafc1b
 The RA will report not running status on hosts where the docker daemon