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