summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-client
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-09-21 19:30:22 +0200
committerChristian Poessinger <christian@poessinger.com>2022-09-21 19:34:23 +0200
commitb004cad76803af1615df8435c9b4881905a5ae64 (patch)
treefe7c985655b7a903c7633f6f6e087495d2518ac2 /data/templates/dhcp-client
parent05df2a5f021f0c7aab7c06db645d210858b6e98d (diff)
downloadvyos-1x-b004cad76803af1615df8435c9b4881905a5ae64.tar.gz
vyos-1x-b004cad76803af1615df8435c9b4881905a5ae64.zip
dhcpv6-pd: T2821: bugfix Jinja2 template - missing conditional if
Specifying "dhcpv6-options pd 0" for any interface without an interface where we delegate an address to resulted in a commit error: {% for interface, interface_config in pd_config.interface.items() if pd_config.interface is vyos_defined %} jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'interface'
Diffstat (limited to 'data/templates/dhcp-client')
-rw-r--r--data/templates/dhcp-client/ipv6.j218
1 files changed, 10 insertions, 8 deletions
diff --git a/data/templates/dhcp-client/ipv6.j2 b/data/templates/dhcp-client/ipv6.j2
index e136b1789..b5e55cdd1 100644
--- a/data/templates/dhcp-client/ipv6.j2
+++ b/data/templates/dhcp-client/ipv6.j2
@@ -40,20 +40,22 @@ id-assoc pd {{ pd }} {
prefix ::/{{ pd_config.length }} infinity;
{% set sla_len = 64 - pd_config.length | int %}
{% set count = namespace(value=0) %}
-{% for interface, interface_config in pd_config.interface.items() if pd_config.interface is vyos_defined %}
+{% if pd_config.interface is vyos_defined %}
+{% for interface, interface_config in pd_config.interface.items() if pd_config.interface is vyos_defined %}
prefix-interface {{ interface }} {
sla-len {{ sla_len }};
-{% if interface_config.sla_id is vyos_defined %}
+{% if interface_config.sla_id is vyos_defined %}
sla-id {{ interface_config.sla_id }};
-{% else %}
+{% else %}
sla-id {{ count.value }};
-{% endif %}
-{% if interface_config.address is vyos_defined %}
+{% endif %}
+{% if interface_config.address is vyos_defined %}
ifid {{ interface_config.address }};
-{% endif %}
+{% endif %}
};
-{% set count.value = count.value + 1 %}
-{% endfor %}
+{% set count.value = count.value + 1 %}
+{% endfor %}
+{% endif %}
};
{% endfor %}
{% endif %}