Fix network rename + service_net_map_replace

If name_lower of a network is changed, and service_net_map_replace
is used. The subnet defined for the network in roles_data would
have to be updated to match the new name_lower. This was not the
case prior to stein, because roles_data did'nt include the subnet.

A downstream regression test is failing because of this. The
workaround is to update roles_data with a value for the subnet
that match name_lower.

This patch should fix the need to update roles_data in the case
that the net_map_replace matches the subnet in roles_data and no
additional subnet with this defined for this network in
network_data.

Closes-Bug: #1832759
Change-Id: I10f99fad0f0016bf81edd53e1c5579f9d5c0ef88
(cherry picked from commit 564d89b2f8)
This commit is contained in:
Harald Jensås 2019-06-12 19:49:20 +02:00
parent 1b30a36250
commit 459b873c29
1 changed files with 5 additions and 0 deletions

View File

@ -487,7 +487,12 @@ resources:
- {{role.name}}_{{network.name}}_fixed_ip_set
- [{ip_address: {get_param: [{{role.name}}IPs, '{{network.name_lower}}', {get_param: NodeIndex}]}}]
{%- if role.networks is mapping and role.networks.get(network.name) %}
{%- if network.get('service_net_map_replace') == role.networks[network.name].get('subnet').split('_subnet', -1)[0]
and role.networks[network.name].get('subnet').split('_subnet', -1)[0] not in network.get('subnets', {}).keys() %}
- [{subnet: {{network.name_lower + '_subnet'}}}]
{%- else %}
- [{subnet: {{role.networks[network.name].get('subnet', network.name_lower + '_subnet')}}}]
{%- endif %}
{%- else %}
- [{subnet: {{network.name_lower}}_subnet}]
{%- endif %}