From 253fef996a7ef770106649dcf62ccf7a2b775adb Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Tue, 13 Aug 2019 17:44:21 +0200 Subject: [PATCH] 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 --- network/network.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/network/network.j2 b/network/network.j2 index ffc2a95db2..9ce02906a0 100644 --- a/network/network.j2 +++ b/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 %}