diff options
| author | Martin Schwenke <martin@meltin.net> | 2012-03-20 16:23:24 +1100 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2012-03-22 15:30:27 +1100 |
| commit | 2f5cb560175c1665325cc82ab102dff8b60f3c4e (patch) | |
| tree | 72665d8ce3eea1f9163888dc6b420cd5a04e0032 | |
| parent | ac973b34df9c62841ea4cd895e127b6a99d9a2c9 (diff) | |
Eventscripts - make 13.per_ip_routing fail gracefully if config is missing
Currently it spews out random messages about the file being missing.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 351ca413eec460330571ca8b01ad269728fe15df)
| -rwxr-xr-x | ctdb/config/events.d/13.per_ip_routing | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ctdb/config/events.d/13.per_ip_routing b/ctdb/config/events.d/13.per_ip_routing index 92a0f8e83a..f51d5edf5f 100755 --- a/ctdb/config/events.d/13.per_ip_routing +++ b/ctdb/config/events.d/13.per_ip_routing @@ -166,6 +166,7 @@ clean_up_table_ids () # This prints the config for an IP, which is either relevant entries # from the config file or, if set to the magic link local value, some # link local routing config for the IP. +# NOTE: non-zero return indicates missing configuration file get_config_for_ip () { _ip="$1" @@ -179,6 +180,8 @@ get_config_for_ip () fi done <"${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE:-/dev/null}${CTDB:+/public_addresses}}" else + [ -f "$CTDB_PER_IP_ROUTING_CONF" ] || return 1 + while read _i _rest ; do if [ "$_ip" = "$_i" ] ; then printf "%s\t%s\n" "$_ip" "$_rest" @@ -191,7 +194,9 @@ ip_has_configuration () { _ip="$1" - [ -n "$(get_config_for_ip $_ip)" ] + _config="$(get_config_for_ip $_ip)" || \ + die "error: CTDB_PER_IP_ROUTING_CONF=$CTDB_PER_IP_ROUTING_CONF file not found" + [ -n "$_config" ] } add_routing_for_ip () @@ -273,7 +278,7 @@ add_missing_routes () add_routing_for_ip "$_iface" "$_ip" fi done - } + } || exit $? } ###################################################################### |
