Blame SOURCES/bz1524454-ocf_attribute_target-fallback-fix.patch

1ee2dd
From f0a7a64d644c604f84ec1668849e1cc5507a8ea8 Mon Sep 17 00:00:00 2001
1ee2dd
From: Damien Ciabrini <dciabrin@redhat.com>
1ee2dd
Date: Tue, 5 Dec 2017 10:43:10 +0100
1ee2dd
Subject: [PATCH] Fix fallback name for ocf_attribute_target
1ee2dd
1ee2dd
For bundles, various resource agents now use ocf_attribute_target to
1ee2dd
get the name of the pacemaker node to store attributes on.
1ee2dd
1ee2dd
If a recent version of the resource agent is being run on a pacemaker
1ee2dd
version which does not support bundles, ocf_attribute_target will
1ee2dd
return an empty string as hostname.
1ee2dd
1ee2dd
Provide a fallback path so the resource agent gets a valid name when
1ee2dd
the resource is not containerized.
1ee2dd
---
1ee2dd
 heartbeat/ocf-shellfuncs.in | 6 +++++-
1ee2dd
 1 file changed, 5 insertions(+), 1 deletion(-)
1ee2dd
1ee2dd
diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
1ee2dd
index ddd6854e9..2fa6f93f9 100644
1ee2dd
--- a/heartbeat/ocf-shellfuncs.in
1ee2dd
+++ b/heartbeat/ocf-shellfuncs.in
1ee2dd
@@ -1010,7 +1010,11 @@ ocf_attribute_target() {
1ee2dd
 		if [ x$OCF_RESKEY_CRM_meta_container_attribute_target = xhost -a x$OCF_RESKEY_CRM_meta_physical_host != x ]; then
1ee2dd
 			echo $OCF_RESKEY_CRM_meta_physical_host
1ee2dd
 		else
1ee2dd
-			echo $OCF_RESKEY_CRM_meta_on_node
1ee2dd
+			if [ x$OCF_RESKEY_CRM_meta_on_node != x ]; then
1ee2dd
+				echo $OCF_RESKEY_CRM_meta_on_node
1ee2dd
+			else
1ee2dd
+				ocf_local_nodename
1ee2dd
+			fi
1ee2dd
 		fi
1ee2dd
 		return
1ee2dd
 	elif [ x"$OCF_RESKEY_CRM_meta_notify_all_uname" != x ]; then