81738cda4d
If role_networks or network_cidrs is not defined, the jinja parsing fails because NoneType is not iterable when doing a 'if value in none_type_var' Change-Id: I477f0b840b2a0d2646ba947a88f5264d330ea4eb Closes-Bug: #1837644
19 lines
1.1 KiB
Django/Jinja
19 lines
1.1 KiB
Django/Jinja
{
|
|
"ctlplane": "{{ ctlplane_ip }}",
|
|
"ctlplane_subnet": "{{ ctlplane_ip ~ '/' ~ ctlplane_subnet_cidr }}",
|
|
"ctlplane_uri": "{{ ctlplane_ip | ipwrap }}"{% if enabled_networks | length > 0 %},{% endif %}
|
|
{%- for network in enabled_networks %}
|
|
{%- if network_cidrs and network ~ '_cidr' in network_cidrs %}
|
|
"{{ networks[network]['name'] }}": "{{ hostvars[inventory_hostname][networks[network]['name'] ~ '_ip'] }}",
|
|
"{{ networks[network]['name'] }}_subnet": "{{ hostvars[inventory_hostname][networks[network]['name'] ~ '_ip'] ~ '/' ~ network_cidrs[network ~ '_cidr'] }}",
|
|
"{{ networks[network]['name'] }}_uri": "{{ hostvars[inventory_hostname][networks[network]['name'] ~ '_ip'] | ipwrap }}"{% if not loop.last %},{% endif %}
|
|
{%- else %}
|
|
{# just add empty entries for this network if it doesn't apply to this role. matches previous behavior from Heat #}
|
|
"{{ networks[network]['name'] }}": "",
|
|
"{{ networks[network]['name'] }}_subnet": "",
|
|
"{{ networks[network]['name'] }}_uri": ""{% if not loop.last %},{% endif %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
|
|
}
|