Use the correct var to calculate address prefix

The _addr loop was inserted but not referenced when calculating the
address host/prefix pair.

Change-Id: I970cc6c12a744fb8a28c2b0ef28e4d08b0c8e90a
This commit is contained in:
Logan V 2018-03-17 21:46:11 -05:00
parent dfc5f5578b
commit 80c397cfb6

View File

@ -21,7 +21,7 @@ Metric={{ 20 + loop.index }}
{%- if item.1.address is not defined %} {%- if item.1.address is not defined %}
{# Address is not defined #} {# Address is not defined #}
{% set _addresses = [] %} {% set _addresses = [] %}
{% elif item.1.address is iterable and not string %} {% elif item.1.address is iterable and item.1.address is not string %}
{# Address is a list, multiple addresses defined #} {# Address is a list, multiple addresses defined #}
{% set _addresses = item.1.address %} {% set _addresses = item.1.address %}
{% else %} {% else %}
@ -37,7 +37,7 @@ Metric={{ 20 + loop.index }}
{% if _addr.address == 'dhcp' %} {% if _addr.address == 'dhcp' %}
DHCP=yes DHCP=yes
{% else %} {% else %}
{% set _addr_cidr = (item.1.address | string + '/' + item.1.netmask | default('') | string).rstrip('/') | ipaddr('host/prefix') %} {% set _addr_cidr = (_addr.address ~ '/' ~ _addr.netmask | default('')).rstrip('/') | ipaddr('host') %}
Address={{ _addr_cidr }} Address={{ _addr_cidr }}
{% endif %} {% endif %}
{% if _addr.gateway is defined %} {% if _addr.gateway is defined %}