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>
-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
############################################################
-[ -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}"
############################################################
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
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
</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>
<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>
<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
<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>
# 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>
<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>
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
</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
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
</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>
<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>
<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>
</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
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
<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>
<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
<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>
<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>
<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
--- /dev/null
+../../config/functions
\ No newline at end of file
--- /dev/null
+../../config/functions
\ No newline at end of file
+# 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
# 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
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
--------------------------------------------------------------------
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
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 ()
{
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
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
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)
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):
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',
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'