Comment 8 for bug 1640488

Revision history for this message
Steven Hardy (shardy) wrote :

For anyone interested in the workaround, it looks like this:

        first_hostname_in_group:
          yaql:
            expression: coalesce($.data, []).first(null)
            data: {get_attr: [TheResourceGroup, hostname]}

hostname returns a list, which may be empty for zero count ResourceGroups, hence the first(null). The coalesce is needed because get_attr returns None during validation, which breaks the query unless we handle it by defaulting to an empty list.