Force host_routes to be a list

In commit 055e252872, we started pulling
the host_routes attribute out of the "addresses" output from the server
resource.

When using deployed-server with DeployedServerPortMap however,
host_routes is not guaranteed to be present within the output value (and
we didn't tell anyone to add it). Since it's not present, it defaults to
{}.

When this value is passed into a nic config template such as
single-nic-vlans/role.role.j2.yaml, it is used as a value to
list_concat_unique to concat host_routes with the route for
169.254.169.254. This causes Heat to fail with an error: "Incorrect
arguments: Items to concat must be lists.".

To fix the scenario where host_routes is not specified in
DeployedServerPortMap, we use a yaql expression to default the value to
[] if it's not already a list.

Change-Id: I6bffc302265c45a2363fa9e973e90ff0938eac5c
This commit is contained in:
James Slagle 2019-02-07 14:56:12 -05:00
parent a857fe1ad6
commit 1d44eeafba

View File

@ -511,7 +511,9 @@ resources:
if: if:
- ctlplane_static_routes_set - ctlplane_static_routes_set
- {get_param: ControlPlaneStaticRoutes} - {get_param: ControlPlaneStaticRoutes}
- {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]} - yaql:
expression: switch(isList($.data) => $.data, true => [])
data: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, host_routes]}
ControlPlaneMtu: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, network, mtu]} ControlPlaneMtu: {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, network, mtu]}
EC2MetadataIp: EC2MetadataIp:
if: if: