[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Thu Jun 19 21:41:04 MDT 2014


The branch, master has been updated
       via  aac607d ctdb-eventscripts: Ensure $GANRECDIR points to configured subdirectory
      from  6f43896 ctdb-daemon: Debugging for tickle updates

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit aac607d7271eb50e776423329f2446a1e33a2641
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jun 16 10:59:20 2014 +1000

    ctdb-eventscripts: Ensure $GANRECDIR points to configured subdirectory
    
    Check that the $GANRECDIR symlink points to the location specified by
    $CTDB_GANESHA_REC_SUBDIR and replace it if incorrect.  This handles
    reconfiguration and filesystem changes.
    
    While touching this code:
    
    * Create the $GANRECDIR link as a separate step if it doesn't exist.
      This means there is only 1 place where the link is created.
    
    * Change some variables names to the style used for local function
      variables.
    
    * Remove some "ln failed" error messages.  ln failures will be logged
      anyway.
    
    * Add -v to various mkdir/rm/ln commands so that these actions are
      logged when they actually do something.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Fri Jun 20 05:40:16 CEST 2014 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 ctdb/config/events.d/60.ganesha |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events.d/60.ganesha b/ctdb/config/events.d/60.ganesha
index e085ed3..df0912d 100755
--- a/ctdb/config/events.d/60.ganesha
+++ b/ctdb/config/events.d/60.ganesha
@@ -84,25 +84,29 @@ create_ganesha_recdirs ()
 {
     [ -n "$CTDB_GANESHA_REC_SUBDIR" ] || CTDB_GANESHA_REC_SUBDIR=".ganesha"
 
-    MOUNTS=$(mount -t $CTDB_CLUSTER_FILESYSTEM_TYPE)
-    if [ -z "$MOUNTS" ]; then
+    _mounts=$(mount -t $CTDB_CLUSTER_FILESYSTEM_TYPE)
+    if [ -z "$_mounts" ]; then
       echo "startup $CTDB_CLUSTER_FILESYSTEM_TYPE not ready"
       exit 0
     fi
-    MNTPT=$(echo "$MOUNTS" | sort | awk 'NR == 1 {print $3}')
-    mkdir -p $MNTPT/$CTDB_GANESHA_REC_SUBDIR
-    if [ -e $GANRECDIR ]; then
-        if [ ! -L $GANRECDIR ] ; then
-            rm -rf $GANRECDIR
-            if ! ln -s $MNTPT/$CTDB_GANESHA_REC_SUBDIR  $GANRECDIR ; then
-                echo "ln failed"
-            fi
-        fi
-    else
-        if ! ln -sf $MNTPT/$CTDB_GANESHA_REC_SUBDIR  $GANRECDIR ; then
-            echo "ln failed"
+    _mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')
+    _link_dst="${_mntpt}/${CTDB_GANESHA_REC_SUBDIR}"
+    mkdir -vp "$_link_dst"
+    if [ -e "$GANRECDIR" ]; then
+        if [ ! -L "$GANRECDIR" ] ; then
+            rm -vrf "$GANRECDIR"
+	else
+	    _t=$(readlink "$GANRECDIR")
+	    if [ "$_t" != "$_link_dst" ] ; then
+		rm -v "$GANRECDIR"
+	    fi
         fi
     fi
+    # This is not an "else".  It also re-creates the link if it was
+    # removed above!
+    if [ ! -e "$GANRECDIR" ]; then
+        ln -sv "$_link_dst" "$GANRECDIR"
+    fi
 
     mkdir -p $GANRECDIR2
     mkdir -p $GANRECDIR3


-- 
Samba Shared Repository


More information about the samba-cvs mailing list