14f8ab
From cb9d0fa4bd2664556f0564406037f9fb7fb781a6 Mon Sep 17 00:00:00 2001
14f8ab
From: Kotresh HR <khiremat@redhat.com>
14f8ab
Date: Wed, 31 Jul 2019 15:40:55 +0530
14f8ab
Subject: [PATCH 266/276] geo-rep: Fix mount broker setup issue
14f8ab
14f8ab
Even the use builtin 'type' command as in patch [1]
14f8ab
causes issues if argument in question is not part of PATH
14f8ab
environment variable for that user. This patch fixes the
14f8ab
same by doing source /etc/profile. This was already being
14f8ab
used in another part of script.
14f8ab
14f8ab
[1] https://review.gluster.org/23089
14f8ab
14f8ab
Backport of:
14f8ab
 > Patch: https://review.gluster.org/23136
14f8ab
 > Change-Id: Iceb78835967ec6a4350983eec9af28398410c002
14f8ab
 > fixes: bz#1734738
14f8ab
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>
14f8ab
14f8ab
Change-Id: Iceb78835967ec6a4350983eec9af28398410c002
14f8ab
BUG: 1734734
14f8ab
Signed-off-by: Kotresh HR <khiremat@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/177867
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 geo-replication/src/gverify.sh | 9 ++++++---
14f8ab
 1 file changed, 6 insertions(+), 3 deletions(-)
14f8ab
14f8ab
diff --git a/geo-replication/src/gverify.sh b/geo-replication/src/gverify.sh
14f8ab
index 692c1d6..f5f70d2 100755
14f8ab
--- a/geo-replication/src/gverify.sh
14f8ab
+++ b/geo-replication/src/gverify.sh
14f8ab
@@ -180,6 +180,8 @@ function main()
14f8ab
     > $log_file
14f8ab
 
14f8ab
     inet6=$7
14f8ab
+    local cmd_line
14f8ab
+    local ver
14f8ab
 
14f8ab
     # Use FORCE_BLOCKER flag in the error message to differentiate
14f8ab
     # between the errors which the force command should bypass
14f8ab
@@ -206,13 +208,14 @@ function main()
14f8ab
         exit 1;
14f8ab
     fi;
14f8ab
 
14f8ab
+    cmd_line=$(cmd_slave);
14f8ab
     if [[ -z "${GR_SSH_IDENTITY_KEY}" ]]; then
14f8ab
-        ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "type -p gluster"
14f8ab
+        ver=$(ssh -p ${SSH_PORT} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 bash -c "'$cmd_line'")
14f8ab
     else
14f8ab
-        ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 "type -p gluster"
14f8ab
+        ver=$(ssh -p ${SSH_PORT} -i ${GR_SSH_IDENTITY_KEY} -oNumberOfPasswordPrompts=0 -oStrictHostKeyChecking=no $2@$3 bash -c "'$cmd_line'")
14f8ab
     fi
14f8ab
 
14f8ab
-    if [ $? -ne 0 ]; then
14f8ab
+    if [ -z "$ver" ]; then
14f8ab
         echo "FORCE_BLOCKER|gluster command not found on $3 for user $2." > $log_file
14f8ab
         exit 1;
14f8ab
     fi;
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab