The branch, 1.0.112 has been updated
       via  3e2b1839a9f8419eeeb7f22ea5925f6c42f32a65 (commit)
       via  eb68bc6f27f9b10abbd5bc4e4fd62b7af54c9abb (commit)
       via  cd8b1eb75f430c589e71b2837dab9d83a12bb43e (commit)
      from  910debaa673319a193374ecc75048e3b8da7564d (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.0.112


- Log -----------------------------------------------------------------
commit 3e2b1839a9f8419eeeb7f22ea5925f6c42f32a65
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Thu Jan 21 18:51:54 2010 +1100

    version 1.0.112-4

commit eb68bc6f27f9b10abbd5bc4e4fd62b7af54c9abb
Author: Martin Schwenke <mar...@meltin.net>
Date:   Thu Jan 21 13:40:03 2010 +1100

    onnode: update algorithm for finding nodes file.
    
    2 changes:
    
    * If a relative nodes file is specified via -f or $CTDB_NODES_FILE but
      this file does not exist then try looking for the file in /etc/ctdb
      (or $CTDB_BASE if set).
    
    * If a nodes file is specified via -f or $CTDB_NODES_FILE but this
      file does not exist (even when checked as per above) then do not
      fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set).  The old
      behaviour was surprising and hid errors.
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>

commit cd8b1eb75f430c589e71b2837dab9d83a12bb43e
Author: Martin Schwenke <mar...@meltin.net>
Date:   Thu Jan 21 13:16:18 2010 +1100

    onnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.
    
    Signed-off-by: Martin Schwenke <mar...@meltin.net>

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

Summary of changes:
 packaging/RPM/ctdb.spec.in |    4 +++-
 tools/onnode               |   23 +++++++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index 30545c5..93f5e22 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <sa...@samba.org>
 Name: ctdb
 Version: 1.0.112
-Release: 3
+Release: 4
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -123,6 +123,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/ctdb/tests/bin/ctdb_transaction
 
 %changelog
+* Wed Jan 21 2010 : Version 1.0.112-4
+ - Update onnode with more flexible ways to define the path to the nodes file
 * Wed Jan 20 2010 : Version 1.0.112-3
  - Explicitely source the nfs sysconfig file from the 61.nfstickles script.
 * Wed Jan 13 2010 : Version 1.0.112-2
diff --git a/tools/onnode b/tools/onnode
index 7c0a86e..fa61b47 100755
--- a/tools/onnode
+++ b/tools/onnode
@@ -63,6 +63,8 @@ quiet=false
 prefix=""
 names_ok=false
 
+ctdb_base="${CTDB_BASE:-/etc/ctdb}"
+
 parse_options ()
 {
     # $POSIXLY_CORRECT means that the command passed to onnode can
@@ -165,7 +167,7 @@ get_nodes_with_status ()
            # Succeeded.  Get address.  NOTE: this is an optimisation.
            # It might be better to get the node number and then get
            # the nth node to get the address.  This would make things
-           # more consistent if /etc/ctdb/nodes actually contained
+           # more consistent if $ctdb_base/nodes actually contained
            # hostnames.
            nodes="${nodes} ${t##*:}"
        fi
@@ -229,8 +231,21 @@ get_nodes ()
     if [ -n "$CTDB_NODES_SOCKETS" ] ; then 
        all_nodes="$CTDB_NODES_SOCKETS"
     else
-       [ -e "$CTDB_NODES_FILE" ] || CTDB_NODES_FILE=/etc/ctdb/nodes
-       all_nodes=$(sed -e 's...@#.*@@g' -e 's@ *@@g' -e 's...@^$@#DEAD@' 
$CTDB_NODES_FILE)
+       local f="${ctdb_base}/nodes"
+       if [ -n "$CTDB_NODES_FILE" ] ; then
+           f="$CTDB_NODES_FILE"
+           if [ ! -e "$f" -a "${f#/}" = "$f" ] ; then
+               # $f is relative, try in $ctdb_base
+               f="${ctdb_base}/${f}"
+           fi
+       fi
+
+       if [ ! -r "$f" ] ; then
+           echo "${prog}: unable to open nodes file  \"${f}\"" >&2
+           exit 1
+       fi
+
+       all_nodes=$(sed -e 's...@#.*@@g' -e 's@ *@@g' -e 's...@^$@#DEAD@' "$f")
     fi
 
     local nodes=""
@@ -305,7 +320,7 @@ if [ -n "$CTDB_NODES_SOCKETS" ] ; then
     SSH=fakessh
 else 
     # Could "2>/dev/null || true" but want to see errors from typos in file.
-    [ -r /etc/ctdb/onnode.conf ] && . /etc/ctdb/onnode.conf
+    [ -r "${ctdb_base}/onnode.conf" ] && . "${ctdb_base}/onnode.conf"
     [ -n "$SSH" ] || SSH=ssh
     if [ "$SSH" = "ssh" ] ; then
        ssh_opts="-n"


-- 
CTDB repository

Reply via email to