Skip to content

Commit

Permalink
Fix(eos_config_deploy_cvp): avoid making CV_DEVICES becoming None (#1300
Browse files Browse the repository at this point in the history
)

Co-authored-by: ClausHolbechArista <48674677+ClausHolbechArista@users.noreply.github.com>
  • Loading branch information
noredistribution and ClausHolbechArista authored Nov 25, 2021
1 parent 6a6b913 commit 49bb10f
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{% set local_var = namespace() %}
{% set local_var.device_filter = [] %}
{% if device_filter is string %}
{% do local_var.device_filter.append(device_filter) %}
{% do local_var.device_filter.append(device_filter) %}
{% else %}
{% set local_var.device_filter = device_filter %}
{% set local_var.device_filter = device_filter %}
{% endif %}
{% set dev_cntr = namespace(value=0) %}
---
CVP_DEVICES:
{% for device in groups[container_root] | arista.avd.natural_sort %}
{% if device | arista.avd.is_in_filter(local_var.device_filter) %}
{% if hostvars[device]['is_deployed'] is arista.avd.defined(true) or hostvars[device]['is_deployed'] is not arista.avd.defined %}
- fqdn: {{ device }}
{% set dev_cntr.value = dev_cntr.value + 1 %}
{% for container_name, container in CVP_VARS.CVP_TOPOLOGY.items() | arista.avd.natural_sort %}
{% if 'devices' in container %}
{% for device_container in container['devices']%}
{% for device_container in container['devices'] %}
{% if device == device_container %}
parentContainerName: {{ container_name }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
configlets:
{% if hostvars[groups[container_root][0]]['cv_configlets']['devices'][device] is defined %}
{% if hostvars[groups[container_root][0]]['cv_configlets']['devices'][device] is arista.avd.defined %}
{% for configlet in hostvars[groups[container_root][0]]['cv_configlets']['devices'][device] | arista.avd.natural_sort %}
- {{ configlet }}
{% endfor %}
Expand All @@ -30,6 +32,9 @@ CVP_DEVICES:
{% endif %}
{% endif %}
{% endfor %}
{% if dev_cntr.value == 0 %}
[]
{% endif %}
CVP_CONTAINERS:
{% for container_name, container in CVP_VARS.CVP_TOPOLOGY.items() | arista.avd.natural_sort %}
{{ container_name }}:
Expand All @@ -39,5 +44,5 @@ CVP_CONTAINERS:
{% for configlet in hostvars[groups[container_root][0]]['cv_configlets']['containers'][container_name] | arista.avd.natural_sort %}
- {{ configlet }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

0 comments on commit 49bb10f

Please sign in to comment.