mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
bae9feacf2
To keep this commit comprehensible, 11.natgw and the CTDB CLI tool are temporarily inconsistent. The tool will be made consistent in a subsequent commit. ctdb_natgw_slave_only() is reimplemented to check for the option in the appropriate line in $CTDB_NATGW_NODES. Update unit tests and documentation. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
35 lines
649 B
Bash
Executable File
35 lines
649 B
Bash
Executable File
#!/bin/sh
|
|
|
|
prog="ctdb_natgw"
|
|
|
|
not_implemented_exit_code=1
|
|
|
|
not_implemented ()
|
|
{
|
|
echo "${prog}: command \"$1\" not implemented in stub" >&2
|
|
exit $not_implemented_exit_code
|
|
}
|
|
|
|
ctdb_natgw_master ()
|
|
{
|
|
[ -r "$CTDB_NATGW_NODES" ] || \
|
|
die "error: missing CTDB_NATGW_NODES=${CTDB_NATGW_NODES}"
|
|
|
|
# Determine the master node
|
|
_master="-1 0.0.0.0"
|
|
_pnn=0
|
|
while read _ip ; do
|
|
if [ "$FAKE_CTDB_NATGW_MASTER" = "$_ip" ] ; then
|
|
_master="${_pnn} ${_ip}"
|
|
break
|
|
fi
|
|
_pnn=$(($_pnn + 1))
|
|
done <"$CTDB_NATGW_NODES"
|
|
echo "$_master"
|
|
}
|
|
|
|
case "$1" in
|
|
master) ctdb_natgw_master "$@" ;;
|
|
*) not_implemented "$1" ;;
|
|
esac
|