Browse Source

Fix "ManageNetworks" use-case

With change I603521bd00dc100e03c765c25503b5e01f3383e4
the ManageNetworks == False use case was overlooked.

When ManageNetworks is set to False and networks are
not created we need to build network_attrs and
subnet_attrs from the data present in network_data.yaml
and parameters.

Closes-Bug: #1920050
Change-Id: I98a3d582add0d6881cd39433ddb25515f0e0dc31
(cherry picked from commit 80b226c44c)
changes/63/792163/1
Harald Jensås 5 months ago
parent
commit
d39526de13
  1. 37
      network/network.j2

37
network/network.j2

@ -297,13 +297,44 @@ outputs:
- "{{network.subnets[subnet]['ip_subnet']|default("")}}"
{%- endif %}
{%- endfor %}
network_attrs:
description: {{network.name}} network's attributes
value: {get_attr: [{{network.name}}Network, show]}
value:
if:
- manage_networks
- {get_attr: [{{network.name}}Network, show]}
- name: {{network.name_lower}}
dns_domain:
list_join:
- '.'
- - {{network.name.lower()}}
- {get_param: CloudDomain}
- ''
mtu: {{network.mtu|default('1500')}}
subnet_attrs:
description: Map of attributes for subnets in the {{network.name}} network
value:
{{network.name_lower}}_subnet: {get_attr: [{{network.name}}Subnet, show]}
if:
- manage_networks
- {{network.name_lower}}_subnet: {get_attr: [{{network.name}}Subnet, show]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{subnet}}: {get_attr: [{{network.name}}Subnet_{{subnet}}, show]}
{%- endfor %}
- {{network.name_lower}}_subnet:
name: {{network.name_lower}}_subnet
cidr: {get_param: {{network.name}}NetCidr}
dns_nameservers: []
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute}
host_routes: {get_param: {{network.name}}Routes}
ip_version: {if: [is_ipv6, 6, 4]}
{%- for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %}
{{subnet}}: {get_attr: [{{network.name}}Subnet_{{subnet}}, show]}
{{subnet}}:
name: {{subnet}}
cidr: {get_param: {{network.name}}SubnetCidr_{{subnet}}}
dns_nameservers: []
gateway_ip: {get_param: {{network.name}}InterfaceDefaultRoute_{{subnet}}}
host_routes: {get_param: {{network.name}}Routes_{{subnet}}}
ip_version: {if: [is_ipv6, 6, 4]}
{%- endfor %}
Loading…
Cancel
Save