Hi,
We’re switching from StackStorm 2.9 to StackStorm 3.0 and at the same time from Mistral/Jinja to Orquesta/YAQL: a lot of changes!
Right now I’m struggling with “loops” (with items) in my workflow: all I want to do is being able to access the current item’s attributes in my action (last line in my snippet below).
Here is my very simple workflow:
version: 1.0
tasks:
run_health_check:
action: company.cli
input:
cli_params: healthcheck 'server_category==foobar'
next:
- when: <% succeeded() %>
publish:
- unhealthy_servers: <% result().stdout %>
do:
- process_broken_servers
process_broken_servers:
with:
items: <% ctx(unhealthy_servers) %>
concurrency: 1
action: core.noop
next:
- when: <% succeeded() %>
do:
- double_check_server
double_check_server:
action: company.cli
input:
cli_params: healthcheck 'server_id==<% item().id %>'
The action “company.cli” outputs a string which is a JSON array:
[
{
"id": 123
"name": "foobar"
}
}
How can I access the attributes of the item()? Right now, when I try this workflow, I have the following error:
YaqlEvaluationException: Unable to evaluate expression '<% item().id %>'. NoFunctionRegisteredException: Unknown function \"#property#id\"