Use make_url to wrap IPv6 addresses in brackets.

Replace the dependency of network data values for wrapping
'ip_address_uri' in brackets. Instead of using jinja2
variables network.ipv6 or ipv6_override to decide if the
IP need to be wrapped in brackets or not the make_url
function in heat in combination with a str_replace is
used.

Related-Bug: #1830406
Change-Id: I2d8c405c1df30ac11cc2286398fe4749694da10e
This commit is contained in:
Harald Jensås 2019-05-22 16:23:53 +02:00
parent c06232fba2
commit 824dd9003a
9 changed files with 74 additions and 38 deletions

View File

@ -69,7 +69,13 @@ outputs:
value: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
ip_address_uri:
description: Virtual IP network IP (for compatibility with vip_v6.yaml)
value: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
value:
str_replace:
template:
make_url:
host: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the ctlplane network.
value:

View File

@ -43,7 +43,13 @@ resources:
- - {get_param: ControlPlaneIp}
- '/'
- {get_param: ControlPlaneSubnetCidr}
ctlplane_uri: {get_param: ControlPlaneIp}
ctlplane_uri:
str_replace:
template:
make_url:
host: {get_param: ControlPlaneIp}
params:
//: ''
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}Ip}
{{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet}

View File

@ -31,8 +31,20 @@ outputs:
for a specific machine.
value:
ctlplane: {get_param: ControlPlaneIP}
ctlplane_uri: {get_param: ControlPlaneIP}
ctlplane_uri:
str_replace:
template:
make_url:
host: {get_param: ControlPlaneIP}
params:
//: ''
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{{network.name_lower}}_uri: {get_param: {{network.name}}NetworkVip}
{{network.name_lower}}_uri:
str_replace:
template:
make_url:
host: {get_param: {{network.name}}NetworkVip}
params:
//: ''
{%- endfor %}

View File

@ -31,13 +31,20 @@ outputs:
for a specific machine.
value:
ctlplane: {get_param: ControlPlaneIP}
ctlplane_uri: {get_param: ControlPlaneIP}
ctlplane_uri:
str_replace:
template:
make_url:
host: {get_param: ControlPlaneIP}
params:
//: ''
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{{network.name_lower}}_uri:
list_join:
- ''
- - '['
- {get_param: {{network.name}}NetworkVip}
- ']'
str_replace:
template:
make_url:
host: {get_param: {{network.name}}NetworkVip}
params:
//: ''
{%- endfor %}

View File

@ -60,7 +60,13 @@ outputs:
value: {get_param: ControlPlaneIP}
ip_address_uri:
description: pass thru network IP (for compatibility with vip_v6.yaml)
value: {get_param: ControlPlaneIP}
value:
str_replace:
template:
make_url:
host: {get_param: ControlPlaneIP}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the pass thru network IP
value:

View File

@ -82,18 +82,14 @@ outputs:
description: {{network.name}} network IP
value: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
ip_address_uri:
{%- if network.ipv6 or ipv6_override|default(false) %}
description: {{network.name}} network IP (with brackets for IPv6 URLs)
value:
list_join:
- ''
- - '['
- {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
- ']'
{%- else %}
description: {{network.name}} network IP (for compatibility with IPv6 URLs)
value: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
{%- endif %}
str_replace:
template:
make_url:
host: {get_attr: [{{network.name}}Port, fixed_ips, 0, ip_address]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the {{network.name}} network IP
value:

View File

@ -58,18 +58,14 @@ outputs:
description: {{network.name}} network IP
value: {get_param: [IPPool, {get_param: {{network.name}}NetName}, {get_param: NodeIndex}]}
ip_address_uri:
{%- if network.ipv6 or ipv6_override|default(false) %}
description: {{network.name}} network IP (with brackets for IPv6 URLs)
value:
list_join:
- ''
- - '['
- {get_param: [IPPool, {get_param: {{network.name}}NetName}, {get_param: NodeIndex}]}
- ']'
{%- else %}
description: {{network.name}} network IP (for compatibility with {{network.name_lower}}_v6.yaml)
value: {get_param: [IPPool, {get_param: {{network.name}}NetName}, {get_param: NodeIndex}]}
{%- endif %}
str_replace:
template:
make_url:
host: {get_param: [IPPool, {get_param: {{network.name}}NetName}, {get_param: NodeIndex}]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the {{network.name}} network IP
value:

View File

@ -77,7 +77,13 @@ outputs:
value: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
ip_address_uri:
description: Virtual IP network IP (for compatibility with vip.yaml)
value: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
value:
str_replace:
template:
make_url:
host: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the network associated with this IP
value:

View File

@ -76,13 +76,14 @@ outputs:
description: Virtual IP network IP
value: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
ip_address_uri:
description: Virtual IP with brackets suitable for a URL
description: Virtual IP network IP (for compatibility with vip.yaml)
value:
list_join:
- ''
- - '['
- {get_attr: [VipPort, fixed_ips, 0, ip_address]}
- ']'
str_replace:
template:
make_url:
host: {get_attr: [VipPort, fixed_ips, 0, ip_address]}
params:
//: ''
ip_subnet:
description: IP/Subnet CIDR for the network associated with this IP
value: