Always clean up space bird configuration

Also silence some output from errors on deleting links and rules that
may not exist.

DEV-2560
This commit is contained in:
Nick Huber 2019-08-02 14:48:28 -07:00
parent a9e02455b2
commit 5a56a06148

View File

@ -194,10 +194,7 @@ function stop() {
eval $args
echo "Stopping $space"
if [ -z "${SPACES[$space]}" ] ; then
echo "Space not found"
return 1
fi
systemctl stop "yap-space@$space.service" --no-block
}
@ -206,6 +203,8 @@ function service_stop() {
args=$(check_args space,,$1) || return 1
eval $args
rm -f /etc/yap/bird/$space.conf
if [ -z "${SPACES[$space]}" ] ; then
echo "Space not found"
return 1
@ -216,11 +215,10 @@ function service_stop() {
vlan_id=$2
table_id=$(get_table_id $space_id)
rm -f /etc/yap/bird/$space.conf
reload ||:
ip link del vl-$space ||:
ip rule del iif vl-$space lookup $table_id prio 900 ||:
ip link del vl-$space &>/dev/null ||:
ip rule del iif vl-$space lookup $table_id prio 900 &>/dev/null ||:
}
@ -348,7 +346,7 @@ function _check_policy_rule() {
disable_bird_protocols $space
if ! ip rule | grep -qe "iif vl-$space" ; then
if ip link show dev vl-$space > /dev/null 2>&1 ; then
if ip link show dev vl-$space &> /dev/null ; then
echo "Adding missing ip rule for $space"
ip rule add iif vl-$space lookup $table_id prio 900
fi