From 1311f8a521c6045f53ef99acba0e68cb74943b23 Mon Sep 17 00:00:00 2001 From: ramishra Date: Wed, 12 May 2021 08:46:56 +0530 Subject: [PATCH] Don't assume every role has default_route_networks This broken after new jinja release. NOTE: This included nic config updates as well. Co-Authored-By: Alex Schultz Closes-Bug: #1928145 Change-Id: I9cbdcf289bae96f8ea7867e1cec365a9a07019ca (cherry picked from commit 4af0c6ccac891fceff68a92e05c1734e27fbc1e0) --- network/config/2-linux-bonds-vlans/role.role.j2.yaml | 2 +- network/config/bond-with-vlans/role.role.j2.yaml | 2 +- network/config/multiple-nics-vlans/role.role.j2.yaml | 2 +- network/config/multiple-nics/role.role.j2.yaml | 2 +- .../single-nic-linux-bridge-vlans/role.role.j2.yaml | 2 +- network/config/single-nic-vlans/role.role.j2.yaml | 2 +- overcloud.j2.yaml | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/network/config/2-linux-bonds-vlans/role.role.j2.yaml b/network/config/2-linux-bonds-vlans/role.role.j2.yaml index 472b23c910..b7f5055251 100644 --- a/network/config/2-linux-bonds-vlans/role.role.j2.yaml +++ b/network/config/2-linux-bonds-vlans/role.role.j2.yaml @@ -59,7 +59,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for the {{network.name_lower}} network diff --git a/network/config/bond-with-vlans/role.role.j2.yaml b/network/config/bond-with-vlans/role.role.j2.yaml index a9456cf63a..98dc91ac6e 100644 --- a/network/config/bond-with-vlans/role.role.j2.yaml +++ b/network/config/bond-with-vlans/role.role.j2.yaml @@ -57,7 +57,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for the {{network.name_lower}} network diff --git a/network/config/multiple-nics-vlans/role.role.j2.yaml b/network/config/multiple-nics-vlans/role.role.j2.yaml index 06ce28868d..b98809ab50 100644 --- a/network/config/multiple-nics-vlans/role.role.j2.yaml +++ b/network/config/multiple-nics-vlans/role.role.j2.yaml @@ -59,7 +59,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for 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 3e4b1d4d2f..61ec5c4c0d 100644 --- a/network/config/multiple-nics/role.role.j2.yaml +++ b/network/config/multiple-nics/role.role.j2.yaml @@ -59,7 +59,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for 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 9a87e182c0..465388a9af 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 @@ -57,7 +57,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for 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 43e5bc51fd..a00fe89c68 100644 --- a/network/config/single-nic-vlans/role.role.j2.yaml +++ b/network/config/single-nic-vlans/role.role.j2.yaml @@ -57,7 +57,7 @@ parameters: guaranteed to pass through the data path of the segments in the {{network.name}} network. type: number -{%- if network.name in role.default_route_networks %} +{%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: default: '' description: default route for the {{network.name_lower}} network diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index b33eade66e..1d90b05719 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -1031,7 +1031,7 @@ resources: {{network.name_lower}}_host_routes: list_concat_unique: - {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, host_routes]} - {%- if network.name in role.default_route_networks %} + {%- if role.default_route_networks is defined and network.name in role.default_route_networks %} - - default: true next_hop: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, gateway_ip]} {%- endif %} @@ -1075,7 +1075,7 @@ resources: service_metadata_settings: {get_attr: [{{role.name}}ServiceChainRoleData, value, service_metadata_settings]} tripleo_network_config_template: {get_param: {{role.name}}NetworkConfigTemplate} tripleo_network_config_with_ansible: {get_param: NetworkConfigWithAnsible} - default_route_networks: {{role.default_route_networks}} + default_route_networks: {{role.default_route_networks|default(['ControlPlane'])}} networks_skip_config: {{ role.networks_skip_config|default([]) }} role_tags: {{role.tags}} @@ -1108,7 +1108,7 @@ resources: {{network.name}}InterfaceRoutes: list_concat_unique: - {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, host_routes]} - {%- if network.name in role.default_route_networks %} + {%- if role.default_route_networks is defined and network.name in role.default_route_networks %} - - default: true next_hop: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, gateway_ip]} {%- endif %} @@ -1120,7 +1120,7 @@ resources: not $.data.where($.startsWith('tripleo_vlan_id')).len() => 1, true => int($.data.where($.startsWith('tripleo_vlan_id')).first().split('=').last())) data: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, tags]} - {%- if network.name in role.default_route_networks %} + {%- if role.default_route_networks is defined and network.name in role.default_route_networks %} {{network.name}}InterfaceDefaultRoute: {get_attr: [Networks, net_attributes_map, {{network.name_lower}}, subnets, {{_role_net_subnet}}, gateway_ip]} {%- endif %} {%- endfor %}