summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeghana Madhusudhan <mmadhusu@redhat.com>2014-08-26 16:40:49 +0530
committerVijay Bellur <vbellur@redhat.com>2014-08-31 11:05:04 -0700
commit9816fe18e839eb195a6f4482311b65df995b920f (patch)
tree24d06bb0b4cb7da9413672915dbe97af3a99b72f
parentf52efa681b1a16c287ed00e2a79cc7f05e65fed1 (diff)
Hook scripts should exit with correct exit status.
When volume set options other than nfs-ganesha.host and nfs-ganesha.enable are executed, the hook script S31ganesha-set.sh should exit with exit status 0. The present behaviour results in an error message in one of the logs that could be misleading. Similarly, hook script S30samba-set.sh should exit with exit status 0 if samba is not installed. Fixing the issue with a minor change in the script. Change-Id: I35d1dc8400bb7043385800ed97adc5321829437f BUG: 1122978 Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com> Reviewed-on: http://review.gluster.org/8385 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xextras/hook-scripts/set/post/S30samba-set.sh5
-rwxr-xr-xextras/hook-scripts/set/post/S31ganesha-set.sh20
2 files changed, 16 insertions, 9 deletions
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index 9153dcd0bb2..4bac61f48a1 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -115,16 +115,17 @@ if [ "0" = $(is_volume_started "$VOL") ]; then
exit 0
fi
-#Find smb.conf, smbd pid directory and smbd logfile path
-find_config_info
if [ "$enable_smb" = "enable" ]; then
+ #Find smb.conf, smbd pid directory and smbd logfile path
+ find_config_info
if ! grep --quiet "\[gluster-$VOL\]" /etc/samba/smb.conf ; then
add_samba_share $VOL
sighup_samba
fi
elif [ "$enable_smb" = "disable" ]; then
+ find_config_info
del_samba_share $VOL
sighup_samba
fi
diff --git a/extras/hook-scripts/set/post/S31ganesha-set.sh b/extras/hook-scripts/set/post/S31ganesha-set.sh
index b09a3942a8e..f839aa37061 100755
--- a/extras/hook-scripts/set/post/S31ganesha-set.sh
+++ b/extras/hook-scripts/set/post/S31ganesha-set.sh
@@ -3,6 +3,7 @@ PROGNAME="Sganesha-set"
OPTSPEC="volname:,gd-workdir:"
VOL=
declare -i EXPORT_ID
+ganesha_key="FALSE"
GANESHA_DIR="/var/lib/glusterfs-ganesha"
CONF1="$GANESHA_DIR/nfs-ganesha.conf"
GANESHA_LOG_DIR="/var/log/nfs-ganesha/"
@@ -13,7 +14,6 @@ host_name="none"
LOC=""
GLUSTERD_WORKDIR=
-
function parse_args ()
{
ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@)
@@ -34,12 +34,14 @@ function parse_args ()
for pair in $@; do
read key value < <(echo "$pair" | tr "=" " ")
case "$key" in
- "nfs-ganesha.enable")
- enable_ganesha=$value
- ;;
- "nfs-ganesha.host")
- host_name=$value
- ;;
+ "nfs-ganesha.enable")
+ enable_ganesha=$value
+ ganesha_key="TRUE"
+ ;;
+ "nfs-ganesha.host")
+ host_name=$value
+ ganesha_key="TRUE"
+ ;;
*)
;;
esac
@@ -257,6 +259,10 @@ function stop_ganesha()
}
parse_args $@
+ if [ "$ganesha_key" == "FALSE" ]
+ then
+ exit 0
+ fi
check_ganesha_dir $VOL
if echo $enable_ganesha | grep -q -i "ON"
then