StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.07k stars 749 forks source link

orquesta with-items-model for dict error #5547

Open jiangxianfu opened 2 years ago

jiangxianfu commented 2 years ago

SUMMARY

orquesta with-items-model for dict is error

i compare two version ,data class type is different

stackstorm 3.5
yaql: $.items() type is: <class 'generator'> <generator object ItemsView.iter at 0x7f5146a85d58>

stackstorm 3.6 yaql: $.items() type is: class collections.abc.ItemsView

STACKSTORM VERSION

stacstorm 3.6 is error stackstorm 3.5 is ok

OS, environment, install method

in docker

Steps to reproduce the problem

version: "1.0"
description: test with.
input:
  - input_num
tasks:
  task0:
    action: core.echo message=ok
    input:
      input_num: <% ctx().input_num %>
    next:
      - when: <% succeeded() %>
        publish:
          - messages: <% result().result %>
        do: task1

  task1:
    with: k, v in <% ctx(messages).items() %>
    action: core.echo message=<% item(v) %>

Expected Results

YaqlEvaluationException: Unable to evaluate expression '<% ctx(messages).items() %>'. TypeError: unhashable type: 'list",

Actual Results

stackstorm 3.5 is ok

stacstorm 3.6 is error

but, when i change source code at stackstorm 3.6 (yaql/language/utils.py): engine.options.get('yaql.convertSetsToLists', False)===>engine.options.get('yaql.convertSetsToLists', True) then it works ok. !!!!! why?

Thanks!

stale[bot] commented 2 years ago

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.