Merge pull request #10 in PAR/yap from bugfix/DEV-2459-yap-tries-to-access-invalid-space-field-when-generating-aggregator-s-config to master

* commit '570012443c11296679cea6af442804d1b0b9fb4c':
  Don't try to enable spaces that don't have a VLAN set
This commit is contained in:
Nick Huber 2019-06-20 16:56:13 -07:00
commit 459bbc0148
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"
}