summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-04-07 09:09:29 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2017-04-13 11:37:57 -0400
commite93e89b2e46033efa22447943269000c85588254 (patch)
tree5ebe46d8fc7dd28dc1aaac0a434cf881d42c7fb5 /extras
parent0090727aea9dfcfdd06debadeb5cf9377adca64f (diff)
common-ha: fixes for Debian-based systems
1) Debian-based systems don't have /usr/libexec/... and there is a hard-coded invocation of /usr/libexec/ganesha/ganesha-ha.sh within ganesha-ha.sh itself. Fix: save $0 and use it instead for further invocations of self. 2) default shell is /bin/dash (not /bin/bash). Various runner_run() invocations for ganesha used what amounts to exec("sh /usr/$libexec/ganesha/ganesha-ha.sh ...); which executes the script using the default shell, but there are some bash-specific idioms that don't work if the shell is dash. Fix: change to exec("/usr/$libexec/ganesha/ganesha-ha.sh ...); so that the shebang forces the use of /bin/bash 3) Fedora and RHEL7 have merged /bin/ and /usr/bin, /bin is a symlink to /usr/bin. Debian-based systems are not merged, and systemd systems have /bin/systemctl. The logic to find .../bin/systemctl is backwards. If the logic looks for /usr/bin/systemctl it will not find it on Debian-based systems; if it looks for /bin/systemctl it will find it on Fedora and RHEL by virtue of the symlink. (RHEL6 and others will find their respective init regardless.) Fix: change the logic to look for /bin/systemctl instead. 4) The logic for deciding to run systemctl (or not) is a bit silly. Fix: simply invoke the found method via the function pointer in the table. Change-Id: I33681b296a73aebb078bda6ac0d3a1d3b9770a21 BUG: 1440148 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: https://review.gluster.org/17013 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/ganesha/scripts/ganesha-ha.sh21
1 files changed, 11 insertions, 10 deletions
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index f8eb776a1a8..b62fb306cc9 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -20,6 +20,7 @@
# ensure that the NFS GRACE DBUS signal is sent after the VIP moves to
# the new host.
+GANESHA_HA_SH=$(realpath $0)
HA_NUM_SERVERS=0
HA_SERVERS=""
HA_VOL_NAME="gluster_shared_storage"
@@ -68,9 +69,9 @@ function find_rhel7_conf
done
}
-if [ -z $CONFFILE ]
+if [ -z ${CONFFILE} ]
then
- find_rhel7_conf $OPTIONS
+ find_rhel7_conf ${OPTIONS}
fi
@@ -90,9 +91,9 @@ usage() {
determine_service_manager () {
- if [ -e "/usr/bin/systemctl" ];
+ if [ -e "/bin/systemctl" ];
then
- SERVICE_MAN="/usr/bin/systemctl"
+ SERVICE_MAN="/bin/systemctl"
elif [ -e "/sbin/invoke-rc.d" ];
then
SERVICE_MAN="/sbin/invoke-rc.d"
@@ -100,7 +101,7 @@ determine_service_manager () {
then
SERVICE_MAN="/sbin/service"
fi
- if [ "$SERVICE_MAN" == "DISTRO_NOT_FOUND" ]
+ if [ "${SERVICE_MAN}" == "DISTRO_NOT_FOUND" ]
then
echo "Service manager not recognized, exiting"
exit 1
@@ -113,21 +114,21 @@ manage_service ()
local new_node=${2}
local option=
- if [ "$action" == "start" ]; then
+ if [ "${action}" == "start" ]; then
option="yes"
else
option="no"
fi
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "/usr/libexec/ganesha/ganesha-ha.sh --setup-ganesha-conf-files $HA_CONFDIR $option"
+${SECRET_PEM} root@${new_node} "${GANESHA_HA_SH} --setup-ganesha-conf-files $HA_CONFDIR $option"
- if [ "$SERVICE_MAN" == "/usr/bin/systemctl" ]
+ if [ "${SERVICE_MAN}" == "/bin/systemctl" ]
then
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "$SERVICE_MAN ${action} nfs-ganesha"
+${SECRET_PEM} root@${new_node} "${SERVICE_MAN} ${action} nfs-ganesha"
else
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "$SERVICE_MAN nfs-ganesha ${action}"
+${SECRET_PEM} root@${new_node} "${SERVICE_MAN} nfs-ganesha ${action}"
fi
}