Wrong variable assignment in orquesta workflow
SUMMARY
Var doesn't get updated in Orquesta workflow
STACKSTORM VERSION
st2 3.6.0, on Python 3.8.10
OS, environment, install method
Post what OS you are running this on, along with any other relevant information/
Docker
Steps to reproduce the problem
Show how to reproduce the problem, using a minimal test-case. Make sure to include any content Workflow:
version: 1.0
description: A basic sequential workflow.
input:
- name
vars:
- greeting: {}
tasks:
task1:
action: dc.test
input:
flag: true
next:
- when: <% succeeded() %>
publish:
- greeting: <% result().result["test"] %>
do: task2
task2:
action: core.echo
input:
message: "All your base are belong to us!"
next:
- when: <% succeeded() %>
do:
- task3
task3:
action: dc.test
input:
flag: false
next:
- when: <% succeeded() %>
publish:
- greeting: <% result().result["test"] %>
do: task4
task4:
action: dc.test1
input:
ob: <% ctx().greeting %>
Action file from st2common.runners.base_action import Action
class Test(Action):
def run(self, flag, *args, **kwargs):
if flag:
return {"test": {"abc": "def"}}
else:
return {"test": {}}
Expected Results
In task1 we have published greeting obj as {"test": {"abc": "def"} And in task3 we published the same greeting obj as {}
So we are expecting the greeting obj to have {} (empty dict) as the value. But it is still having the value as {"test": {"abc": "def"} We are assuming this is just updating the existing var/dict with the new keys when they are published and replacing existing ones with new values.
What did you expect to happen when running the steps above?
We expected an empty object assignment to greeting variable. But it is still pointing to previously published object
What is your action definition file? Check the definition of the flag parameter, and check its not been set to a constant (e.g. immutable=true) When your task_3 action is run in the workflow can you observe the result that is published, to check if its coming out with the {} dictionary or the "abc":"def" dictionary - to see if the problem is on the re-publish or on the action itself.
@amanda11 Action definiton file.
---
name: test
pack: dc
description: test
runner_type: python-script
entry_point: lib/test.py
enabled: true
parameters:
flag:
type: boolean
description: "flag"
required: true
I've attached some screenshots for you to look over.
task3 action output. (correct result is published)
The same output is fed as input to task4
BUMP!
@armab BUMP!