ctdb-scripts: Update important installed files to use build-time defaults
authorMartin Schwenke <martin@meltin.net>
Mon, 17 Aug 2015 10:47:58 +0000 (20:47 +1000)
committerMichael Adam <obnox@samba.org>
Tue, 15 Sep 2015 06:56:21 +0000 (08:56 +0200)
In this case: ctdbd_wrapper, onnode, ctdb_diagnostics, ctdb.sudoers.
Set sensible defaults from configure options.

Update documentation to match, trying to fix up anything that has been
missed before.

The onnode unit tests need a symlink to the functions file.
The simple integration tests need to set CTDB_BASE and also
need symlinks to functions/nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
fixup

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 files changed:
ctdb/config/ctdb.sudoers
ctdb/config/ctdbd_wrapper
ctdb/config/functions
ctdb/doc/ctdb.1.xml
ctdb/doc/ctdb.7.xml
ctdb/doc/ctdbd.1.xml
ctdb/doc/ctdbd.conf.5.xml
ctdb/doc/onnode.1.xml
ctdb/tests/onnode/functions [new symlink]
ctdb/tests/simple/functions [new symlink]
ctdb/tests/simple/scripts/local.bash
ctdb/tools/ctdb_diagnostics
ctdb/tools/onnode
ctdb/wscript

index 1c6619b654b72754cebc796fa6bbee9d29c636da..1c238180cc9ebe2a6a7f9d3a9acf2c5bf61b257b 100644 (file)
@@ -1,3 +1,3 @@
-Defaults!/etc/ctdb/statd-callout       !requiretty
+Defaults!/usr/local/etc/ctdb/statd-callout     !requiretty
 
-rpcuser                ALL=(ALL)       NOPASSWD: /etc/ctdb/statd-callout
+rpcuser                ALL=(ALL)       NOPASSWD: /usr/local/etc/ctdb/statd-callout
index c5fe00451dfe1e188c1bbcd4646c0f0f65bbd9ed..66d88c9559cd83235ec1f3c38d4730a624fe0b51 100755 (executable)
@@ -15,14 +15,16 @@ action="$2"
 
 ############################################################
 
-[ -n "$CTDB_BASE" ] || export CTDB_BASE="/etc/ctdb"
+if [ -z "$CTDB_BASE" ] ; then
+    export CTDB_BASE="/usr/local/etc/ctdb"
+fi
 
 . "${CTDB_BASE}/functions"
 loadconfig "ctdb"
 
 [ -n "$CTDB_SOCKET" ] && export CTDB_SOCKET
 
-ctdbd="${CTDBD:-/usr/sbin/ctdbd}"
+ctdbd="${CTDBD:-/usr/local/sbin/ctdbd}"
 
 ############################################################
 
@@ -184,7 +186,7 @@ start()
 
     if [ -n "$CTDB_VALGRIND" -a "$CTDB_VALGRIND" != "no" ] ; then
        if [ "$CTDB_VALGRIND" = "yes" ] ; then
-           ctdbd="valgrind -q --log-file=/var/log/ctdb_valgrind ${ctdbd}"
+           ctdbd="valgrind -q --log-file=/usr/local/var/log/ctdb_valgrind ${ctdbd}"
        else
            ctdbd="${CTDB_VALGRIND} ${ctdbd}"
        fi
index 994c638a5bb656eb7ee9bad391e4996e9fa883e7..49bed988f5e4fec51542b47bd321a86ee8f9071e 100755 (executable)
@@ -101,7 +101,7 @@ script_log ()
            if [ -n "$CTDB_LOGGING" ] ; then
                _file="${CTDB_LOGGING#file:}"
            else
-               _file="/var/log/log.ctdb"
+               _file="/usr/local/var/log/log.ctdb"
            fi
            {
                if [ -n "$*" ] ; then
index 17347297a9450d15ab2d9df4437e9eba25cd5706..613efff426fc78f36e047ab535c5c318ed2c8722 100644 (file)
@@ -1105,7 +1105,7 @@ DB Statistics: locking.tdb
        </listitem>
        <listitem>
          <para>
-           On all nodes, edit <filename>/etc/ctdb/nodes</filename>
+           On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
            and <emphasis>add the new nodes at the end of this
            file</emphasis>.
          </para>
@@ -1113,7 +1113,7 @@ DB Statistics: locking.tdb
        <listitem>
          <para>
            Verify that all the nodes have identical
-           <filename>/etc/ctdb/nodes</filename> files after adding
+           <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
            the new nodes.
          </para>
        </listitem>
@@ -1156,7 +1156,7 @@ DB Statistics: locking.tdb
        <listitem>
          <para>
            On all other nodes, edit the
-           <filename>/etc/ctdb/nodes</filename> file and
+           <filename>/usr/local/etc/ctdb/nodes</filename> file and
            <emphasis>comment out</emphasis> the nodes to be removed.
            <emphasis>Do not delete the lines for the deleted
            nodes</emphasis>, just comment them out by adding a '#' at
@@ -1217,24 +1217,24 @@ DB Statistics: locking.tdb
        <screen>
 # ctdb getdbmap
 Number of databases:10
-dbid:0x435d3410 name:notify.tdb path:/var/ctdb/notify.tdb.0 
-dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
-dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0 
-dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0 
-dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0 
-dbid:0x122224da name:test.tdb path:/var/ctdb/test.tdb.0 
-dbid:0x2672a57f name:idmap2.tdb path:/var/ctdb/persistent/idmap2.tdb.0 PERSISTENT
-dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT
-dbid:0xe98e08b6 name:group_mapping.tdb path:/var/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
-dbid:0x7bbbd26c name:passdb.tdb path:/var/ctdb/persistent/passdb.tdb.0 PERSISTENT
+dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
+dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
+dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
+dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
+dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
+dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
+dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
+dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
+dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
+dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
 
 # ctdb getdbmap  # example for unhealthy database
 Number of databases:1
-dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
+dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
 
 # ctdb -X getdbmap
 |ID|Name|Path|Persistent|Unhealthy|
-|0x7bbbd26c|passdb.tdb|/var/ctdb/persistent/passdb.tdb.0|1|0|
+|0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
        </screen>
       </refsect3>
     </refsect2>
@@ -1534,16 +1534,16 @@ RUNNING
 # ctdb getdbstatus test.tdb.0
 dbid: 0x122224da
 name: test.tdb
-path: /var/ctdb/test.tdb.0
+path: /usr/local/var/lib/ctdb/test.tdb.0
 PERSISTENT: no
 HEALTH: OK
 
 # ctdb getdbstatus registry.tdb  # with a corrupted TDB
 dbid: 0xf2a58948
 name: registry.tdb
-path: /var/ctdb/persistent/registry.tdb.0
+path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
 PERSISTENT: yes
-HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/var/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
+HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
        </screen>
       </refsect3>
     </refsect2>
index ad17df7de59eca338b0bcb264330344d36fd9567..ffa51db7ce0e265534f30f0cdcf534a7c633c2b1 100644 (file)
         <varname>CTDB_NODES</varname> configuration variable (see
         <citerefentry><refentrytitle>ctdbd.conf</refentrytitle>
         <manvolnum>5</manvolnum></citerefentry>, default
-        <filename>/etc/ctdb/nodes</filename>).  This file contains the
+        <filename>/usr/local/etc/ctdb/nodes</filename>).  This file contains the
         list of private addresses for all nodes in the cluster, one
         per line. This file must be the same on all nodes in the
         cluster.
       </para>
 
       <para>
-       Example <filename>/etc/ctdb/nodes</filename> for a four node
+       Example <filename>/usr/local/etc/ctdb/nodes</filename> for a four node
        cluster:
       </para>
       <screen format="linespecific">
        configuration variable (see
        <citerefentry><refentrytitle>ctdbd.conf</refentrytitle>
        <manvolnum>5</manvolnum></citerefentry>, recommended
-       <filename>/etc/ctdb/public_addresses</filename>).  This file
+       <filename>/usr/local/etc/ctdb/public_addresses</filename>).  This file
        contains a list of the public addresses that the node is
        capable of hosting, one per line.  Each entry also contains
        the netmask and the interface to which the address should be
       </para>
 
       <para>
-       Example <filename>/etc/ctdb/public_addresses</filename> for a
+       Example <filename>/usr/local/etc/ctdb/public_addresses</filename> for a
        node that can host 4 public addresses, on 2 different
        interfaces:
       </para>
        Example: 4 nodes partitioned into two subgroups:
       </para>
       <screen format="linespecific">
-Node 0:/etc/ctdb/public_addresses
+Node 0:/usr/local/etc/ctdb/public_addresses
        10.1.1.1/24 eth1
        10.1.1.2/24 eth1
 
-Node 1:/etc/ctdb/public_addresses
+Node 1:/usr/local/etc/ctdb/public_addresses
        10.1.1.1/24 eth1
        10.1.1.2/24 eth1
 
-Node 2:/etc/ctdb/public_addresses
+Node 2:/usr/local/etc/ctdb/public_addresses
        10.1.2.1/24 eth2
        10.1.2.2/24 eth2
 
-Node 3:/etc/ctdb/public_addresses
+Node 3:/usr/local/etc/ctdb/public_addresses
        10.1.2.1/24 eth2
        10.1.2.2/24 eth2
       </screen>
@@ -649,7 +649,7 @@ CTDB_LVS_PUBLIC_IP=10.1.1.237
        NATGW is usually configured similar to the following example configuration:
       </para>
       <screen format="linespecific">
-CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
+CTDB_NATGW_NODES=/usr/local/etc/ctdb/natgw_nodes
 CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24
 CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
 CTDB_NATGW_PUBLIC_IFACE=eth0
@@ -871,12 +871,12 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
       </para>
 
       <screen>
-/etc/ctdb/public_addresses:
+/usr/local/etc/ctdb/public_addresses:
 
   192.168.1.98 eth2,eth3
   192.168.1.99 eth2,eth3
 
-/etc/ctdb/policy_routing:
+/usr/local/etc/ctdb/policy_routing:
 
   192.168.1.98 192.168.1.0/24
   192.168.1.98 192.168.200.0/24        192.168.1.254
@@ -910,9 +910,9 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
       The specified script must be executable.  
     </para>
     <para>
-      Use of the provided <filename>/etc/ctdb/notify.sh</filename>
+      Use of the provided <filename>/usr/local/etc/ctdb/notify.sh</filename>
       script is recommended.  It executes files in
-      <filename>/etc/ctdb/notify.d/</filename>.
+      <filename>/usr/local/etc/ctdb/notify.d/</filename>.
     </para>
     <para>
       CTDB currently generates notifications after CTDB changes to
index 8f6b7c9ac5f743af051d0a628a09b9337aca7768..8516e8f000afc194c91d11e602b1b22fa658bbc0 100644 (file)
          </para>
          <para>
            Default is <envar>CTDB_BASE</envar>/events.d, so usually
-           <filename>/etc/ctdb/events.d</filename>, which is part of
+           <filename>/usr/local/etc/ctdb/events.d</filename>, which is part of
            the CTDB installation.
          </para>
        </listitem>
        <listitem>
          <para>
            STRING specifies where ctdbd will write its log. The
-           default is file:<filename>/var/log/log.ctdb</filename> or
-           similar - the prefix may differ depending on how CTDB was
-           built.
+           default is
+           file:<filename>/usr/local/var/log/log.ctdb</filename>.
          </para>
          <para>
            Valid values are:
              <listitem>
                <para>
                  FILENAME where ctdbd will write its log. This is usually
-                 <filename>/var/log/log.ctdb</filename>.
+                 <filename>/usr/local/var/log/log.ctdb</filename>.
                </para>
              </listitem>
            </varlistentry>
          </para>
          <para>
            Default is <envar>CTDB_BASE</envar>/nodes, so usually
-           <filename>/etc/ctdb/nodes</filename>.
+           <filename>/usr/local/etc/ctdb/nodes</filename>.
          </para>
        </listitem>
       </varlistentry>
          </para>
          <para>
            This file is usually
-           <filename>/etc/ctdb/notify.sh</filename>.
+           <filename>/usr/local/etc/ctdb/notify.sh</filename>.
          </para>
          <para>
            Please see the <citetitle>NOTIFICATION SCRIPT</citetitle>
          </para>
          <para>
            This is usually the file
-           <filename>/etc/ctdb/public_addresses</filename>
+           <filename>/usr/local/etc/ctdb/public_addresses</filename>
          </para>
        </listitem>
       </varlistentry>
index 082af0c1503684fa7ff077f88cc225785f774905..e4048310ccedff34fc8b649dde09c07330552a58 100644 (file)
@@ -23,7 +23,7 @@
     <para>
       This file contains CTDB configuration variables that are affect
       the operation of CTDB.  The default location of this file is
-      <filename>/etc/ctdb/ctdbd.conf</filename>.
+      <filename>/usr/local/etc/ctdb/ctdbd.conf</filename>.
     </para>
 
     <para>
@@ -44,7 +44,7 @@
       <filename>/etc/default/ctdb</filename> (Debian).  However, these
       files should be reserved for variables used by the initscript.
       A historical alternative is
-      <filename>/etc/ctdb/sysconfig/ctdb</filename> - this is
+      <filename>/usr/local/etc/ctdb/sysconfig/ctdb</filename> - this is
       deprecated.
     </para>
 
@@ -76,7 +76,7 @@
          </para>
 
          <para>
-           Default is <filename>/var/run/ctdb/ctdbd.pid</filename>.
+           Default is <filename>/usr/local/var/run/ctdb/ctdbd.pid</filename>.
            Corresponds to <option>--pidfile</option>.
          </para>
        </listitem>
        <listitem>
          <para>
            Default is <varname>CTDB_BASE</varname>/events.d, so usually
-           <filename>/etc/ctdb/events.d</filename>.  Corresponds to
+           <filename>/usr/local/etc/ctdb/events.d</filename>.  Corresponds to
            <option>--event-script-dir</option>.
          </para>
        </listitem>
        <listitem>
          <para>
            STRING specifies where ctdbd will write its log. The
-           default is file:<filename>/var/log/log.ctdb</filename> or
-           similar - the prefix may differ depending on how CTDB was
-           built.  Corresponds to <option>--logging</option>.
+           default is
+           file:<filename>/usr/local/var/log/log.ctdb</filename>.
+           Corresponds to <option>--logging</option>.
          </para>
          <para>
            Valid values are:
              <listitem>
                <para>
                  FILENAME where ctdbd will write its log. This is usually
-                 <filename>/var/log/log.ctdb</filename>.
+                 <filename>/usr/local/var/log/log.ctdb</filename>.
                </para>
              </listitem>
            </varlistentry>
        <listitem>
          <para>
            Default is <varname>CTDB_BASE</varname>/nodes, so usually
-           <filename>/etc/ctdb/nodes</filename>.  Corresponds to
+           <filename>/usr/local/etc/ctdb/nodes</filename>.  Corresponds to
            <option>--nlist</option>.
          </para>
        </listitem>
        <listitem>
          <para>
            No default, usually
-           <filename>/etc/ctdb/notify.sh</filename>.  Corresponds to
+           <filename>/usr/local/etc/ctdb/notify.sh</filename>.  Corresponds to
            <option>--notification-script</option>.
          </para>
        </listitem>
        <listitem>
          <para>
            No default, usually
-           <filename>/etc/ctdb/public_addresses</filename>.
+           <filename>/usr/local/etc/ctdb/public_addresses</filename>.
            Corresponds to <option>--public-addresses</option>.
          </para>
        </listitem>
            </para>
            <para>
              No default, usually
-             <filename>/etc/ctdb/natgw_nodes</filename> when enabled.
+             <filename>/usr/local/etc/ctdb/natgw_nodes</filename> when enabled.
            </para>
          </listitem>
        </varlistentry>
       <refsect3>
        <title>Example</title>
        <screen>
-CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
+CTDB_NATGW_NODES=/usr/local/etc/ctdb/natgw_nodes
 CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24
 CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
 CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
@@ -674,7 +674,7 @@ CTDB_NATGW_PUBLIC_IFACE=eth0
          always reachable would look like this:
        </para>
        <screen>
-CTDB_NATGW_NODES=/etc/ctdb/natgw_nodes
+CTDB_NATGW_NODES=/usr/local/etc/ctdb/natgw_nodes
 CTDB_NATGW_PRIVATE_NETWORK=192.168.1.0/24
 CTDB_NATGW_PUBLIC_IP=10.0.0.227/24
 CTDB_NATGW_PUBLIC_IFACE=eth0
@@ -736,7 +736,7 @@ CTDB_NATGW_STATIC_ROUTES=10.0.0.0/24
 
            <para>
              No default, usually
-             <filename>/etc/ctdb/policy_routing</filename> when enabled.
+             <filename>/usr/local/etc/ctdb/policy_routing</filename> when enabled.
            </para>
          </listitem>
        </varlistentry>
@@ -802,7 +802,7 @@ CTDB_NATGW_STATIC_ROUTES=10.0.0.0/24
       <refsect3>
        <title>Example</title>
        <screen>
-CTDB_PER_IP_ROUTING_CONF=/etc/ctdb/policy_routing
+CTDB_PER_IP_ROUTING_CONF=/usr/local/etc/ctdb/policy_routing
 CTDB_PER_IP_ROUTING_RULE_PREF=100
 CTDB_PER_IP_ROUTING_TABLE_ID_LOW=1000
 CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
@@ -1628,7 +1628,7 @@ CTDB_SET_MonitorInterval=20
            <manvolnum>1</manvolnum></citerefentry> to be run under
            <citerefentry><refentrytitle>valgrind</refentrytitle>
            <manvolnum>1</manvolnum></citerefentry> with logs going to
-           <filename>/var/log/ctdb_valgrind</filename>.  If neither
+           <filename>/usr/local/var/log/ctdb_valgrind</filename>.  If neither
            "yes" nor "no" then the value is assumed to be a COMMAND
            (e.g. a <command>valgrind</command> variation, a
            <citerefentry><refentrytitle>gdb</refentrytitle>
@@ -1665,10 +1665,10 @@ CTDB_SET_MonitorInterval=20
     <title>FILES</title>
 
     <simplelist>
-      <member><filename>/etc/ctdb/ctdbd.conf</filename></member>
+      <member><filename>/usr/local/etc/ctdb/ctdbd.conf</filename></member>
       <member><filename>/etc/sysconfig/ctdb</filename></member>
       <member><filename>/etc/default/ctdb</filename></member>
-      <member><filename>/etc/ctdb/sysconfig/ctdb</filename></member>
+      <member><filename>/usr/local/etc/ctdb/sysconfig/ctdb</filename></member>
     </simplelist>
   </refsect1>
 
index ec878031633652b96a6d9d8eef41e005be68f23f..02898d2d65da49c2cebaefb98136e06805cc724b 100644 (file)
@@ -61,8 +61,8 @@
           <para>
             Specify an alternative nodes FILENAME to use instead of
             the default.  This option overrides the CTDB_NODES_FILE
-            environment variable.  See the discussion of
-            <filename>/etc/ctdb/nodes</filename> in the FILES section
+            and CTDB_NODES variables.  See the discussion of
+            <filename>/usr/local/etc/ctdb/nodes</filename> in the FILES section
             for more details.
          </para>
         </listitem>
       node, preceded by the node's hostname
     </para>
     <screen format="linespecific">
-      onnode all "hostname; tail -5 /var/log/log.ctdb"
+      onnode all "hostname; tail -5 /usr/local/var/log/log.ctdb"
     </screen>
 
     <para>
         <listitem>
           <para>
            Directory containing CTDB configuration files.  The
-           default is <filename>/etc/ctdb</filename>.
+           default is <filename>/usr/local/etc/ctdb</filename>.
          </para>
         </listitem>
       </varlistentry>
     <title>FILES</title>
 
     <variablelist>
-      <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
+      <varlistentry><term><filename>/usr/local/etc/ctdb/nodes</filename></term>
         <listitem>
           <para>
             Default file containing a list of each node's IP address
             or hostname.
          </para>
          <para>
-           Actually, the default is
+           As above, a file specified via the <option>-f</option> or
+           <envar>CTDB_NODES_FILE</envar> is given precedence.  If a
+           relative path is specified and no corresponding file
+           exists relative to the current directory then the file is
+           also searched for in the <filename>$CTDB_BASE</filename>
+           directory.
+         </para>
+         <para>
+           If <envar>CTDB_NODES_FILE</envar> is not set and
+           <envar>CTDB_NODES</envar> is set in configuration then the
+           file pointed to by <envar>CTDB_NODES</envar> is used.
+         </para>
+         <para>
+           Otherwise the default is
            <filename>$CTDB_BASE/nodes</filename>, where
            <envar>CTDB_BASE</envar> defaults to
-           <filename>/etc/ctdb</filename>.  If a relative path is
-           given (via the -f option or <envar>CTDB_BASE</envar>) and
-           no corresponding file exists relative to the current
-           directory then the file is also searched for in the
-           <filename>$CTDB_BASE</filename> directory.
-         </para>
-        </listitem>
+           <filename>/usr/local/etc/ctdb</filename>.
+          </para>
+       </listitem>
       </varlistentry>
 
-      <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
+      <varlistentry><term><filename>/usr/local/etc/ctdb/onnode.conf</filename></term>
         <listitem>
           <para>
             If this file exists it is sourced by onnode.  The main
diff --git a/ctdb/tests/onnode/functions b/ctdb/tests/onnode/functions
new file mode 120000 (symlink)
index 0000000..ff10411
--- /dev/null
@@ -0,0 +1 @@
+../../config/functions
\ No newline at end of file
diff --git a/ctdb/tests/simple/functions b/ctdb/tests/simple/functions
new file mode 120000 (symlink)
index 0000000..ff10411
--- /dev/null
@@ -0,0 +1 @@
+../../config/functions
\ No newline at end of file
index 81fc0f02bff711a2c2e727b54a57fc257808dfb0..1ccbb235f1d5cfd0e72821e9de5d7e2e4dde5f69 100644 (file)
@@ -1,3 +1,8 @@
+# onnode needs CTDB_BASE to be set when run in-tree
+if [ -z "$CTDB_BASE" ] ; then
+    export CTDB_BASE="$TEST_SUBDIR"
+fi
+
 if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
     . "${TEST_SUBDIR}/scripts/local_daemons.bash"
 fi
index 96ab5d0ddfca1ecb2ad286faaa29749b9d41a757..a8c8c4281d601e5ec18ee08181a3886f7db5fd63 100755 (executable)
@@ -72,14 +72,14 @@ PATH="$PATH:/sbin:/usr/sbin:/usr/lpp/mmfs/bin"
 # list of config files that must exist and that we check are the same 
 # on the nodes
 if [ -d /etc/sysconfig ] ; then
-    CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/sysconfig/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/sysconfig/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
+    CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /usr/local/etc/ctdb/nodes /etc/sysconfig/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/sysconfig/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
 else
-    CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/default/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/default/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
+    CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /usr/local/etc/ctdb/nodes /etc/default/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/default/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
 fi
 
 # list of config files that may exist and should be checked that they
 # are the same on the nodes
-CONFIG_FILES_MAY="/etc/ctdb/public_addresses /etc/ctdb/static-routes"
+CONFIG_FILES_MAY="/usr/local/etc/ctdb/public_addresses /usr/local/etc/ctdb/static-routes"
 
 2>&1
 
@@ -181,7 +181,7 @@ cat <<EOF
 For reference, here is the nodes file on the current node...
 EOF
 
-show_file /etc/ctdb/nodes
+show_file /usr/local/etc/ctdb/nodes
 
 cat <<EOF
 --------------------------------------------------------------------
@@ -236,14 +236,14 @@ show_all "ctdb getdbmap"
 show_all "ctdb -X getdbmap | awk -F'|' 'NR > 1 {print \$3}' | sort | xargs -n 1 ctdb dbstatistics"
 
 echo "Showing log.ctdb"
-show_all "test -f /var/log/log.ctdb && tail -100 /var/log/log.ctdb"
+show_all "test -f /usr/local/var/log/log.ctdb && tail -100 /usr/local/var/log/log.ctdb"
 
 echo "Showing log.ctdb"
-show_all "test -f /var/log/log.ctdb && tail -100 /var/log/log.ctdb"
+show_all "test -f /usr/local/var/log/log.ctdb && tail -100 /usr/local/var/log/log.ctdb"
 
 show_all "tail -200 /var/log/messages"
-show_all "ls -lRs /var/ctdb"
-show_all "ls -lRs /etc/ctdb"
+show_all "ls -lRs /usr/local/var/lib/ctdb"
+show_all "ls -lRs /usr/local/etc/ctdb"
 
 
 cat <<EOF
index 2ca3113b9d44705ff2d7f0a64c7f1334bc1df166..104295ebac6b7b74b1f3018ec26c16347cae92f3 100755 (executable)
@@ -67,7 +67,12 @@ names_ok=false
 push=false
 stdin=false
 
-ctdb_base="${CTDB_BASE:-/etc/ctdb}"
+if [ -z "$CTDB_BASE" ] ; then
+    CTDB_BASE="/usr/local/etc/ctdb"
+fi
+
+. "${CTDB_BASE}/functions"
+loadconfig "ctdb"
 
 parse_options ()
 {
@@ -258,13 +263,15 @@ get_nodes ()
     if [ -n "$CTDB_NODES_SOCKETS" ] ; then 
        all_nodes="$CTDB_NODES_SOCKETS"
     else
-       local f="${ctdb_base}/nodes"
+       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}"
+               # $f is relative, try in $CTDB_BASE
+               f="${CTDB_BASE}/${f}"
            fi
+       elif [ -n "$CTDB_NODES" ] ; then
+           f="$CTDB_NODES"
        fi
 
        if [ ! -r "$f" ] ; then
@@ -367,7 +374,7 @@ else
        EXTRA_SSH_OPTS=""
     else 
        # Could "2>/dev/null || true" but want to see errors from typos in file.
-       [ -r "${ctdb_base}/onnode.conf" ] && . "${ctdb_base}/onnode.conf"
+       [ -r "${CTDB_BASE}/onnode.conf" ] && . "${CTDB_BASE}/onnode.conf"
        [ -n "$SSH" ] || SSH=ssh
        if [ "$SSH" = "ssh" ] ; then
            if $parallel || ! $stdin ; then
index c8dd44e43662bd8d8316f22be3693b08b0ccb596..a883872e05d77ca4e05b97d1fcb2df830f1049c6 100755 (executable)
@@ -449,7 +449,12 @@ def build(bld):
                           destname='README')
 
     sed_expr1 = 's|/usr/local/var/lib/ctdb|%s|g'  % (bld.env.CTDB_VARDIR)
-    sed_cmdline = '-e "%s"' % (sed_expr1)
+    sed_expr2 = 's|/usr/local/etc/ctdb|%s|g'      % (bld.env.CTDB_ETCDIR)
+    sed_expr3 = 's|/usr/local/var/log|%s|g'       % (bld.env.CTDB_LOGDIR)
+    sed_expr4 = 's|/usr/local/var/run/ctdb|%s|g'  % (bld.env.CTDB_RUNDIR)
+    sed_expr5 = 's|/usr/local/sbin|%s|g'          % (bld.env.SBINDIR)
+    sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
+                       (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5)
 
     for f in manpages:
         x = '%s.xml' % (f)
@@ -463,11 +468,25 @@ def build(bld):
                         ctdb.7 ctdb-statistics.7 ctdb-tunables.7''',
                       True)
 
-    bld.INSTALL_FILES('${BINDIR}', 'tools/onnode',
+    bld.SAMBA_GENERATOR('ctdb-onnode',
+                        source='tools/onnode',
+                        target='onnode',
+                        rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
+    bld.INSTALL_FILES('${BINDIR}', 'onnode',
                       destname='onnode', chmod=0755)
-    bld.INSTALL_FILES('${BINDIR}', 'tools/ctdb_diagnostics',
+
+    bld.SAMBA_GENERATOR('ctdb-diagnostics',
+                        source='tools/ctdb_diagnostics',
+                        target='ctdb_diagnostics',
+                        rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
+    bld.INSTALL_FILES('${BINDIR}', 'ctdb_diagnostics',
                       destname='ctdb_diagnostics', chmod=0755)
-    bld.INSTALL_FILES('${SBINDIR}', 'config/ctdbd_wrapper',
+
+    bld.SAMBA_GENERATOR('ctdbd-wrapper',
+                        source='config/ctdbd_wrapper',
+                        target='ctdbd_wrapper',
+                        rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
+    bld.INSTALL_FILES('${SBINDIR}', 'ctdbd_wrapper',
                       destname='ctdbd_wrapper', chmod=0755)
 
     def SUBDIR_MODE_callback(arg, dirname, fnames):
@@ -521,7 +540,11 @@ def build(bld):
         bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % t,
                           destname=t, chmod=0755)
 
-    bld.INSTALL_FILES('${SYSCONFDIR}/sudoers.d', 'config/ctdb.sudoers',
+    bld.SAMBA_GENERATOR('ctdb-sudoers',
+                        source='config/ctdb.sudoers',
+                        target='ctdb.sudoers',
+                        rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
+    bld.INSTALL_FILES('${SYSCONFDIR}/sudoers.d', 'ctdb.sudoers',
                       destname='ctdb')
 
     bld.INSTALL_FILES('${CTDB_ETCDIR}/notify.d', 'config/notify.d.README',
@@ -665,6 +688,17 @@ def build(bld):
         bld.symlink_as(os.path.join(test_link_dir, t),
                        os.path.join(bld.env.CTDB_ETCDIR, t))
 
+    # Tests that use onnode need to overwrite link to in-tree
+    # functions file when installed
+    bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'onnode/functions'),
+                   os.path.join(bld.env.CTDB_ETCDIR, 'functions'))
+    bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/functions'),
+                   os.path.join(bld.env.CTDB_ETCDIR, 'functions'))
+
+    # Need a link to nodes file because $CTDB_BASE is overridden
+    bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/nodes'),
+                   os.path.join(bld.env.CTDB_ETCDIR, 'nodes'))
+
 
 def testonly(ctx):
     cmd = 'tests/run_tests.sh -V tests/var'