File 0017-sg_persist-fix-matching-of-hex-node-ids-bsc-1048170.patch of Package resource-agents.11561
From 83c0a72044d1dcc62e6a27a3f96418e80ffcc378 Mon Sep 17 00:00:00 2001
From: Daniel Kobras <d.kobras@science-computing.de>
Date: Wed, 28 Sep 2016 15:54:00 +0200
Subject: [PATCH 17/17] sg_persist: fix matching of hex node ids (bsc#1048170)
Make sure grep command matches the actual node id, not some other
numbers within the same line of output.
---
heartbeat/sg_persist | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/heartbeat/sg_persist b/heartbeat/sg_persist
index bd58c040..bdbda339 100755
--- a/heartbeat/sg_persist
+++ b/heartbeat/sg_persist
@@ -191,7 +191,7 @@ sg_persist_init() {
CRM_NODE="${HA_SBIN_DIR}/crm_node"
NODE_ID_DEC=$($CRM_NODE -i)
- NODE=$($CRM_NODE -l | $GREP $NODE_ID_DEC)
+ NODE=$($CRM_NODE -l | $GREP -w ^$NODE_ID_DEC)
NODE=${NODE#$NODE_ID_DEC }
NODE=${NODE% *}
@@ -251,13 +251,13 @@ sg_persist_get_status() {
READ_KEYS=`$SG_PERSIST --in --read-keys $dev 2>&1`
if [ $? -eq 0 ]; then
WORKING_DEVS+=($dev)
- echo $READ_KEYS | $GREP $NODE_ID_HEX >/dev/null
+ echo "$READ_KEYS" | $GREP -w $NODE_ID_HEX\$ >/dev/null
if [ $? -eq 0 ]; then
REGISTERED_DEVS+=($dev)
READ_RESERVATION=`$SG_PERSIST --in --read-reservation $dev 2>&1`
if [ $? -eq 0 ]; then
- echo $READ_RESERVATION | $GREP $NODE_ID_HEX >/dev/null
+ echo "$READ_RESERVATION" | $GREP -w $NODE_ID_HEX\$ >/dev/null
if [ $? -eq 0 ]; then
RESERVED_DEVS+=($dev)
fi
--
2.13.1