Fix external resource usage in additional subnets

When external_resource_subnet_id / external_resource_segment_id
are used in additional subnets, the value is not evaluated correct
and the conditional never met. As a result the created heat
template won't include the extrenal resource reference

subnet contains the name of the subnet, so
subnet.external_resource_segment_id won't return the external
id. Lets use network.subnets[subnet].external_resource_segment_id
instead.

Change-Id: I0a9d3cafa8f66e05410f135b7631fc037d7d2471
Closes-Bug: #1840059
changes/26/676226/1
Martin Schuppert 3 years ago
parent 6745f86f2a
commit 253fef996a
  1. 8
      network/network.j2

@ -171,8 +171,8 @@ resources:
# NOTE(hjensas): Depends-On here to ensure we always create the base subnet
# first. We can only set the segment for existing subnet if there is only
# one segment and only one existing subnet on the network.
{%- if subnet.external_resource_segment_id|default('') %}
external_id: {{ subnet.external_resource_segment_id }}
{%- if network.subnets[subnet].external_resource_segment_id|default('') %}
external_id: {{ network.subnets[subnet].external_resource_segment_id }}
{%- else %}
depends_on: {{network.name}}Subnet
{%- endif %}
@ -184,8 +184,8 @@ resources:
{{network.name}}Subnet_{{subnet}}:
type: OS::Neutron::Subnet
{%- if subnet.external_resource_subnet_id|default('') %}
external_id: {{ subnet.external_resource_subnet_id }}
{%- if network.subnets[subnet].external_resource_subnet_id|default('') %}
external_id: {{ network.subnets[subnet].external_resource_subnet_id }}
{%- endif %}
properties:
{%- if ":" in network.ip_subnet or network.ipv6 or ipv6_override %}

Loading…
Cancel
Save