From 1d44eeafba57036b7c9df5d402308db22ee992e1 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 7 Feb 2019 14:56:12 -0500 Subject: [PATCH] Force host_routes to be a list In commit 055e2528720c8e4801ac97d7d48e1358aad87af4, 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 --- puppet/role.role.j2.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 98b6f672f5..3c1832f453 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -511,7 +511,9 @@ resources: if: - ctlplane_static_routes_set - {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]} EC2MetadataIp: if: