Filter empty string in PingTestGatewayIPsMap yagl

When using `ManageNetworks: false` the gateway IPs are
empty string instead of `null` when not set. The YAQL
expression filters `null` values, but the empty string
value is included in the list. The ping gateway test end
up trying to run "ping $args $empty_string" which fails.

This change improves the yaql expression to also filter
strings with 0 lenght.

Closes-Bug: #1973866
Change-Id: I7d8712223d077ab8e25239b891bd03a1324e01a8
This commit is contained in:
Harald Jensås 2022-05-18 09:22:33 +02:00
parent ccf8e0c33d
commit 7f6a4b4385
2 changed files with 12 additions and 1 deletions

View File

@ -1241,7 +1241,7 @@ resources:
{%- for role in roles %}
{{role.name}}:
yaql:
expression: list($.data.where($ != null)).flatten()
expression: list($.data.where($ != null and len($) > 0)).flatten()
data:
- {get_attr: [Networks, net_attributes_map, ctlplane, subnets, {get_param: {{role.name}}ControlPlaneSubnet}, gateway_ip]}
{%- for network in networks %}

View File

@ -0,0 +1,11 @@
---
fixes:
- |
Fixes an issue where gateway ping validations performed during deployment
would fail. When setting the `ManageNetworks` parameter to `false` and no
gateway was configured, the list of gateway IP addresses to ping would
include empty strings for networks with no gateway. The validation would
attempt to run a ping command without the address to ping, which caused the
deployment to fail. See bug:
`1973866 <https://bugs.launchpad.net/tripleo/+bug/1973866>`_.