1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

Eventscripts: 13.per_ip_routing should always fail if config is missing

Currently, if the configuration file is specified by
$CTDB_PER_IP_ROUTING_CONF but is missing, takeip fails but (the
absent) monitor event "succeeds", so the state of a node will
flip-flop.

Instead of this, if the configuration file is missing then fail early
on for all events.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c64c6c77c3f6aa2898e5a575547b587bea868c76)
This commit is contained in:
Martin Schwenke 2012-07-30 12:51:12 +10:00 committed by Amitay Isaacs
parent ff0830037e
commit 5bbf4b6e30

View File

@ -14,6 +14,15 @@ table_id_prefix="ctdb."
[ "$CTDB_PER_IP_ROUTING_TABLE_ID_LOW" -lt "$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH" ] 2>/dev/null || \
die "error: CTDB_PER_IP_ROUTING_TABLE_ID_LOW[$CTDB_PER_IP_ROUTING_TABLE_ID_LOW] and/or CTDB_PER_IP_ROUTING_TABLE_ID_HIGH[$CTDB_PER_IP_ROUTING_TABLE_ID_HIGH] improperly configured"
have_link_local_config ()
{
[ "$CTDB_PER_IP_ROUTING_CONF" = "__auto_link_local__" ]
}
if ! have_link_local_config && [ ! -r "$CTDB_PER_IP_ROUTING_CONF" ] ; then
die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found"
fi
######################################################################
ipv4_is_valid_addr()
@ -170,7 +179,7 @@ get_config_for_ip ()
{
_ip="$1"
if [ "$CTDB_PER_IP_ROUTING_CONF" = "__auto_link_local__" ] ; then
if have_link_local_config ; then
# When parsing public_addresses also split on '/'. This means
# that we get the maskbits as item #2 without further parsing.
while IFS="/$IFS" read _i _maskbits _x ; do
@ -273,7 +282,7 @@ add_missing_routes ()
add_routing_for_ip "$_iface" "$_ip"
fi
done
}
} || exit $?
}
######################################################################