12a457
From 536cb92b2e46578e8d40799411ab471cbdc48ed7 Mon Sep 17 00:00:00 2001
12a457
From: Jiffin Tony Thottan <jthottan@redhat.com>
12a457
Date: Thu, 5 May 2016 14:52:32 +0530
12a457
Subject: [PATCH 132/139] NFS-Ganesha : Parse the Export_Id correctly for unexporting volume
12a457
12a457
Currently export id parsed using "cut -d ' ' -f8" which might endup
12a457
in giving wrong value. In case of multiple space chracter, output
12a457
may differ. In this all those instance will replaced by awk call
12a457
12a457
>Change-Id: I60dea8ce116900da3c1fc9badf898e51183a2ca1
12a457
>BUG: 1333319
12a457
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
12a457
>Reviewed-on: http://review.gluster.org/14225
12a457
>Smoke: Gluster Build System <jenkins@build.gluster.com>
12a457
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
12a457
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
12a457
>Reviewed-by: soumya k <skoduri@redhat.com>
12a457
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
12a457
>(cherry picked from commit 5440bad91026f27399df51856176aef85c1fcf4d)
12a457
12a457
Change-Id: I60dea8ce116900da3c1fc9badf898e51183a2ca1
12a457
BUG: 1330365
12a457
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/73738
12a457
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
12a457
Tested-by: Soumya Koduri <skoduri@redhat.com>
12a457
---
12a457
 extras/ganesha/scripts/create-export-ganesha.sh |    2 +-
12a457
 extras/ganesha/scripts/dbus-send.sh             |    2 +-
12a457
 extras/ganesha/scripts/ganesha-ha.sh            |    4 ++--
12a457
 3 files changed, 4 insertions(+), 4 deletions(-)
12a457
12a457
diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh
12a457
index bd884b4..c1e02d6 100755
12a457
--- a/extras/ganesha/scripts/create-export-ganesha.sh
12a457
+++ b/extras/ganesha/scripts/create-export-ganesha.sh
12a457
@@ -87,7 +87,7 @@ echo "     }"
12a457
 }
12a457
 
12a457
 write_conf $@ > $GANESHA_DIR/exports/export.$VOL.conf
12a457
-if ! (cat $CONF | grep  $VOL.conf$ )
12a457
+if ! (cat $CONF | grep  $VOL.conf\"$ )
12a457
 then
12a457
 echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF
12a457
 fi
12a457
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
12a457
index 87e616c..9f638ca 100755
12a457
--- a/extras/ganesha/scripts/dbus-send.sh
12a457
+++ b/extras/ganesha/scripts/dbus-send.sh
12a457
@@ -91,7 +91,7 @@ string:"EXPORT(Path=/$VOL)"
12a457
 function dynamic_export_remove()
12a457
 {
12a457
         removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\
12a457
-grep Export_Id | cut -d ' ' -f8`
12a457
+grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'`
12a457
         check_cmd_status `echo $?`
12a457
         dbus-send --print-reply --system \
12a457
 --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
12a457
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
12a457
index 7f1ea4c..a712b27 100644
12a457
--- a/extras/ganesha/scripts/ganesha-ha.sh
12a457
+++ b/extras/ganesha/scripts/ganesha-ha.sh
12a457
@@ -259,7 +259,7 @@ ${tganesha_vol_conf}
12a457
                 removed_id=$(ssh -oPasswordAuthentication=no \
12a457
 -oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \
12a457
 "cat $HA_CONFDIR/exports/export.$VOL.conf |\
12a457
-grep Export_Id | cut -d ' ' -f8")
12a457
+grep Export_Id | awk -F"[=,;]" '{print$2}' | tr -d '[[:space:]]'")
12a457
 
12a457
                 output=$(ssh -oPasswordAuthentication=no \
12a457
 -oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \
12a457
@@ -306,7 +306,7 @@ string:\"EXPORT(Path=/$VOL)\" 2>&1")
12a457
 
12a457
     # Run the same command on the localhost,
12a457
         removed_id=`cat $HA_CONFDIR/exports/export.$VOL.conf |\
12a457
-grep Export_Id | cut -d " " -f8`
12a457
+grep Export_Id | awk -F"[=,;]" '{print$2}' | tr -d '[[:space:]]'`
12a457
         output=$(dbus-send --print-reply --system --dest=org.ganesha.nfsd \
12a457
 /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.RemoveExport \
12a457
 uint16:$removed_id 2>&1)
12a457
-- 
12a457
1.7.1
12a457