Don't try to enable spaces that don't have a VLAN set

Also clean up the custom IP/bird configuration on an aggregator when
deleting a space.

DEV-2459
This commit is contained in:
Brandon Cazander 2019-06-20 16:25:07 -07:00
parent 8c463bebc7
commit 570012443c
2 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,8 @@ YAP_ID='{{ pillar['yap']['yap_id'] }}'
VLAN_TRUNK='{{ pillar['yap']['trunk'] }}'
declare -A SPACES
{% if pillar['yap']['spaces'] %}{% for name, space in pillar['yap']['spaces'].items() %}
{% if space.get('id') %}
SPACES[{{ name }}]='{{ space['id'] }} {{ space['vlan'] }} {{ space.get('ip', '') }}'
{% endif %}
{% endfor %}{% endif %}

9
yap
View File

@ -653,6 +653,15 @@ function space_delete() {
done
done
# Clean up aggregator's space IP/custom configuration automatically
for agg_section in $(list_sections /aggregators/); do
for space_path in $(list_sections $agg_section/spaces/); do
if [ "$(basename $space_path)" = "$space" ] ; then
del_section "$space_path"
fi
done
done
del_section "/spaces/$space"
}