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.08k stars 747 forks source link

!st2 list executions is broken in chatops after API changes #3606

Closed lakshmi-kannan closed 6 years ago

lakshmi-kannan commented 7 years ago

While working on chatops changes, I found out that the "!st2 list executions" is broken.

st2.actions.python.St2ExecutionsListAction: DEBUG    Calling client method "query" with kwargs "{'limit': 10}"
Traceback (most recent call last):
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 259, in <module>
    obj.run()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/st2common/runners/python_action_wrapper.py", line 155, in run
    output = action.run(**self._parameters)
  File "/opt/stackstorm/packs/st2/actions/executions_list.py", line 40, in run
    format_func=format_result)
  File "/opt/stackstorm/packs/st2/actions/lib/action.py", line 103, in _run_client_method
    result = format_func(result, **format_kwargs or {})
  File "/opt/stackstorm/packs/st2/actions/executions_list.py", line 18, in format_result
    return format_client_list_result(result=result, exclude_attributes=EXCLUDE_ATTRIBUTES)
  File "/opt/stackstorm/packs/st2/actions/lib/formatters.py", line 13, in format_client_list_result
    value = item.to_dict(exclude_attributes=exclude_attributes)
AttributeError: 'list' object has no attribute 'to_dict'

From the traceback etc, it looks like our API changes might have broken it. Also, looking at the code, for whatever reason we are querying LiveAction as opposed to Execution. There is too much going on to debug this as part of chatops changes.

Kami commented 7 years ago

I assume the fix will go into v2.3.3 / v2.4.0 since v2.3.2 process is already rolling?

That is if it requires st2 fix and not just a pack fix / change.

Kami commented 7 years ago

I believe the CLI "print note if there are more results" change broke it because query method now return a tuple and previously it just returned a result.

I'm looking into a fix.

Kami commented 7 years ago

https://github.com/StackStorm-Exchange/stackstorm-st2/pull/4 should fix it.

lakshmi-kannan commented 7 years ago

There is also this https://github.com/StackStorm/st2/pull/3616.