Don't add IpList for disabled networks

When disabling networks in network data an IpList
entry was added in {{role.name}}IpListMap. This
caused a validation error.

Add a yaql expression to filter on role networks in
network/ports/net_ip_list_map.j2.yaml. RoleNetIpMap
should'nt have entries for networks not used by the
role that maps to the ctlplane IP.

Depends-On: https://review.opendev.org/710574
Closes-Bug: #1842001
Change-Id: I0cda298b0ed27705a8b6e0f62633af2253d8d0de
This commit is contained in:
Harald Jensås 2019-08-29 23:57:10 +02:00
parent 6112a21aa6
commit f222681a43
3 changed files with 22 additions and 7 deletions

View File

@ -29,6 +29,9 @@ parameters:
default: false
description: Whether this is an cell additional to the default cell.
type: boolean
RoleNetworks:
default: ctlplane
type: comma_delimited_list
conditions:
is_cell: {equals: [{get_param: NovaAdditionalCell}, true]}
@ -62,9 +65,14 @@ resources:
type: json
value:
map_replace:
- ctlplane: {get_param: ControlPlaneIpList}
- yaql:
expression: let(root => $) -> dict($.data.net_ip_map.items().where($[0] in $root.data.role_networks))
data:
role_networks: {get_param: RoleNetworks}
net_ip_map:
ctlplane: {get_param: ControlPlaneIpList}
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}IpList}
{{network.name_lower}}: {get_param: {{network.name}}IpList}
{%- endfor %}
- keys:
ctlplane: ctlplane # Ensure one key is present, in case no enabled networks

View File

@ -660,12 +660,13 @@ resources:
type: OS::TripleO::Network::Ports::NetIpListMap
properties:
ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
{%- else %}
{{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
{%- endif %}
{%- endfor %}
RoleNetworks:
- ctlplane
{%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
- {{network.name_lower}}
{%- endfor %}
EnabledServices: {get_attr: [{{role.name}}ServiceNames, value]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed an issue where disabling one or more networks in
``network_data.yaml`` caused deployment failure. (See bug:
`#1842001 <https://bugs.launchpad.net/tripleo/+bug/1842001>`_)