DeployedServer support for cidr via get_attr

Change I92ee0f9a2107cdf1ca5903d3756a235a79c36c73 implemented a
conditional for ControlPlaneSubnetCidr to be resolved using get_attr
and a str_split. DeployedServer documentation specifies that this
value should be provided to DeployedServerPortMap as a numeric value
(ie; 24) rather than full cidr (ie; 192.168.24.0/24), which causes the
str_split to fail.

This change provides support for both via a yaql expression, and adds
a deprecation note to switch to the full cidr format.

Change-Id: I6d4422b4f1aa52aee2954eb447008d3d24fe8736
This commit is contained in:
Jill Rouleau 2018-08-01 19:36:45 -07:00
parent dfb946ff19
commit 6a1ac35275
2 changed files with 27 additions and 3 deletions

View File

@ -463,7 +463,12 @@ resources:
if:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]}
# DeployedServer docs specify 'cidr: 24' in DeployedServerPortMap.
# Support both that, and 'cidr: 192.168.24.0/24'.
- yaql:
expression: str("{0}".format($.data).split("/")[-1])
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
IPPool:
map_merge:
{%- if role.deprecated_param_ips is defined %}
@ -481,7 +486,10 @@ resources:
if:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]}
- yaql:
expression: str("{0}".format($.data).split("/")[-1])
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
ControlPlaneDefaultRoute:
if:
- ctlplane_default_route_set
@ -514,7 +522,11 @@ resources:
if:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}, 1]}
- yaql:
expression: str("{0}".format($.data).split("/")[-1])
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, cidr]}
{%- for network in networks %}
{{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}

View File

@ -23,3 +23,15 @@ upgrade:
template when the resource is created. Because of this the
parameter must be defined in the network config template, even if
it is not used.
deprecation:
- |
When using deployed-server, the cidr must now be specified in full cidr
notation. Network size alone (cidr:: 24) is deprecated..
For example::
DeployedServerPortMap:
control_virtual_ip:
fixed_ips:
- ip_address: 192.168.100.1
subnets:
- cidr: 192.168.100.0/24