Blob Blame History Raw
From bd3b09252eedbeeab2635f82259714975702257e Mon Sep 17 00:00:00 2001
From: David Vossel <dvossel@redhat.com>
Date: Mon, 20 Jan 2014 10:29:23 -0600
Subject: [PATCH] High: VirtualDomain: Fixes parsing domain name from xml file.

If the domain xml is not generated by virsh, it is possible
VirtualDomain will not be able to detect the domain's name
from the xml file.  This is a result of the parsing command
not taking into account trailing whitespace characters.
---
 heartbeat/VirtualDomain | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain
index 3ca4f6d..11c8df9 100755
--- a/heartbeat/VirtualDomain
+++ b/heartbeat/VirtualDomain
@@ -565,7 +565,7 @@ if [ ! -r $OCF_RESKEY_config ]; then
 fi
 
 # Retrieve the domain name from the xml file.
-DOMAIN_NAME=`egrep '.*<name>.*</name>$' ${OCF_RESKEY_config} | sed -e 's/.*<name>\(.*\)<\/name>$/\1/' 2>/dev/null`
+DOMAIN_NAME=`egrep '[[:space:]]*<name>.*</name>[[:space:]]*$' ${OCF_RESKEY_config} | sed -e 's/[[:space:]]*<name>\(.*\)<\/name>[[:space:]]*$/\1/' 2>/dev/null`
 if [ -z $DOMAIN_NAME ]; then
 	ocf_log err "This is unexpected. Cannot determine domain name."
 	exit $OCF_ERR_GENERIC
-- 
1.8.4.2