From 2f84e6e951a28a01a8da80fecad97b80a7f7f6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 14 Dec 2018 09:58:34 +0100 Subject: [PATCH] Remove unused params in jinja rendered network config templates Since change I07822ec0cba7eed352c0010eb893b5e5a522e95c removed the noop resources only parameters for networks used by the role is passed to the network config templates. Add a conditional when iterating over networks in jinja templates so that only parameters for networks used by the role is included. Change-Id: I8b6c7d247d719a7c8559c4be5e35c478a0f189f7 Related-Bug: #1800811 --- network/config/bond-with-vlans/role.role.j2.yaml | 2 +- network/config/multiple-nics/role.role.j2.yaml | 2 +- network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml | 2 +- network/config/single-nic-vlans/role.role.j2.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/network/config/bond-with-vlans/role.role.j2.yaml b/network/config/bond-with-vlans/role.role.j2.yaml index 2c5027a770..abb7472dba 100644 --- a/network/config/bond-with-vlans/role.role.j2.yaml +++ b/network/config/bond-with-vlans/role.role.j2.yaml @@ -25,7 +25,7 @@ parameters: Unless the default is changed, the parameter is automatically resolved from the subnet host_routes attribute. type: json -{% for network in networks %} +{% for network in networks if network.enabled|default(true) and network.name in role.networks %} {{network.name}}IpSubnet: default: '' description: IP address/subnet on the {{network.name_lower}} network diff --git a/network/config/multiple-nics/role.role.j2.yaml b/network/config/multiple-nics/role.role.j2.yaml index 9bb347ee7b..76aacc17fb 100644 --- a/network/config/multiple-nics/role.role.j2.yaml +++ b/network/config/multiple-nics/role.role.j2.yaml @@ -25,7 +25,7 @@ parameters: Unless the default is changed, the parameter is automatically resolved from the subnet host_routes attribute. type: json -{% for network in networks %} +{% for network in networks if network.enabled|default(true) and network.name in role.networks %} {{network.name}}IpSubnet: default: '' description: IP address/subnet on the {{network.name_lower}} network diff --git a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml index e3a4a96bba..2222abac26 100644 --- a/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml +++ b/network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml @@ -25,7 +25,7 @@ parameters: Unless the default is changed, the parameter is automatically resolved from the subnet host_routes attribute. type: json -{% for network in networks %} +{% for network in networks if network.enabled|default(true) and network.name in role.networks %} {{network.name}}IpSubnet: default: '' description: IP address/subnet on the {{network.name_lower}} network diff --git a/network/config/single-nic-vlans/role.role.j2.yaml b/network/config/single-nic-vlans/role.role.j2.yaml index 0f02e1a574..739952e982 100644 --- a/network/config/single-nic-vlans/role.role.j2.yaml +++ b/network/config/single-nic-vlans/role.role.j2.yaml @@ -25,7 +25,7 @@ parameters: Unless the default is changed, the parameter is automatically resolved from the subnet host_routes attribute. type: json -{% for network in networks %} +{% for network in networks if network.enabled|default(true) and network.name in role.networks %} {{network.name}}IpSubnet: default: '' description: IP address/subnet on the {{network.name_lower}} network