scripts: Remove support for CTDB_OPTIONS configuration variable
authorMartin Schwenke <martin@meltin.net>
Tue, 15 Oct 2013 00:54:58 +0000 (11:54 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 22 Oct 2013 03:34:04 +0000 (14:34 +1100)
Allowing people to put random options in CTDB_OPTIONS complicates some
logic (particularly around use of syslog).  If we're going to have
variables for options then let's make sure we have a variable for each
option and make people use them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit e55f3a1577eff0182802b0341d865d961aeae1c7)

ctdb/config/ctdb.sysconfig
ctdb/config/ctdbd_wrapper
ctdb/config/functions
ctdb/tests/scripts/integration.bash

index 6b7af67f647334a32d924c29b46c51d6db478eb2..8233f27a96c9dc0b9ce55e195e4eb8d134ad3971 100644 (file)
@@ -334,7 +334,3 @@ CTDB_SERVICE_AUTOSTARTSTOP=yes
 # for example
 #    CTDB_SET_TRAVERSETIMEOUT=60
 # you can get a list of variables using "ctdb listvars"
-
-# any other options you might want. Run ctdbd --help for a list
-# CTDB_OPTIONS=
-
index fbc76cf78f62d265943e504a6ccc1a0f2fd92385..259cfe46ea10d437aeacd6cb1c8c8964c2187090 100755 (executable)
@@ -79,6 +79,7 @@ ctdbd_is_running ()
 
 build_ctdb_options ()
 {
+    ctdb_options=""
 
     maybe_set ()
     {
@@ -99,7 +100,7 @@ build_ctdb_options ()
            sep=""
        fi
 
-       CTDB_OPTIONS="${CTDB_OPTIONS}${CTDB_OPTIONS:+ }${1}${sep}${val}"
+       ctdb_options="${ctdb_options}${ctdb_options:+ }${1}${sep}${val}"
     }
 
     if [ -z "$CTDB_RECOVERY_LOCK" ] ; then
@@ -109,7 +110,7 @@ build_ctdb_options ()
 
     maybe_set "--pidfile"                "$pidfile"
 
-    # build up CTDB_OPTIONS variable from optional parameters
+    # build up ctdb_options variable from optional parameters
     maybe_set "--logfile"                "$CTDB_LOGFILE"
     maybe_set "--nlist"                  "$CTDB_NODES"
     maybe_set "--socket"                 "$CTDB_SOCKET"
@@ -181,18 +182,14 @@ start()
        else
            ctdbd="${CTDB_VALGRIND} ${ctdbd}"
        fi
-       CTDB_OPTIONS="${CTDB_OPTIONS} --valgrinding"
+       ctdb_options="${ctdb_options} --valgrinding"
     fi
 
-    # This is ugly but will improve when we get rid of $CTDB_OPTIONS
-    # and use only $CTDB_SYSLOG.
-    case "$CTDB_OPTIONS" in
-       *--syslog*) : ;;
-       *)
-           logger -t ctdbd "CTDB is being run without syslog enabled.  Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}"
-    esac
+    if [ "$CTDB_SYSLOG" != "yes" ] ; then
+       logger -t ctdbd "CTDB is being run without syslog enabled.  Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}"
+    fi
 
-    eval "$ctdbd" "$CTDB_OPTIONS" || return 1
+    eval "$ctdbd" "$ctdb_options" || return 1
 
     # Wait until ctdbd has started and is ready to respond to clients.
     _pid=""
index b22b05e8c92efa177bac259f0a45b00403967e11..878174bc546b07a8d8157e645a2dd0fc1ddc7e19 100755 (executable)
@@ -92,9 +92,6 @@ script_log ()
     if [ "$CTDB_SYSLOG" = "yes" -o -z "$CTDB_LOGFILE" ] ; then
        _using_syslog=true
     fi
-    case "$CTDB_OPTIONS" in
-       *--syslog*) _using_syslog=true ;;
-    esac
 
     if $_using_syslog ; then
        logger -t "ctdbd: ${_tag}" $*
index 888528cb2bb171f6b25a2a9678f90dcb91018f27..59f37c919eafc7dc13f8e5e83420f44f9ea3134b 100644 (file)
@@ -620,12 +620,6 @@ _ctdb_hack_options ()
 {
     local ctdb_options="$*"
 
-    # We really just want to pass CTDB_OPTIONS but on RH
-    # /etc/sysconfig/ctdb can, and frequently does, set that variable.
-    # So instead, we hack badly.  We'll add these as we use them.
-    # Note that these may still be overridden by the above file... but
-    # we tend to use the exotic options here... so that is unlikely.
-
     case "$ctdb_options" in
        *--start-as-stopped*)
            export CTDB_START_AS_STOPPED="yes"