This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

[3.0][Orquesta][YAQL] How to access item() attributes (with items/loop)

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\"

Please see example at st2/orquesta-test-with-items.yaml at master · StackStorm/st2 · GitHub