I’m trying to have the published output of tasks in a serial sequence made available to later tasks, and have looked at the examples and tried to follow them, but am bumping into an error even before it gets to running the tasks, that one of my inputs isn’t defined yet, even though it’s defined by publishing it from a previous task.
How would I go about this more gracefully (and compliant with st2flow?)
Here’s the code:
root@[redacted]]:/opt/stackstorm/packs/default/actions/workflows# st2 execution get 6066484f23fccc3af38f7d9a
id: 6066484f23fccc3af38f7d9a
action.ref: default.workflow1
parameters: None
status: failed (1s elapsed)
start_timestamp: Thu, 01 Apr 2021 22:25:19 UTC
end_timestamp: Thu, 01 Apr 2021 22:25:20 UTC
result:
errors:
- expression: <% ctx(aws_account_id) %>
language: yaql
message: Variable "aws_account_id" is referenced before assignment.
schema_path: properties.tasks.patternProperties.^\w+$.properties.input
spec_path: tasks.task3.input
type: context
output: null
root@[redacted]]:/opt/stackstorm/packs/default/actions/workflows# cat -n workflow1.yaml
1 version: 1.0
2 tasks:
3 # [38, 67]
4 task1:
5 action: custompack.get_info
6 next:
7 # #d14c83
8 - do:
9 - task2
10 when: succeeded()
11 publish:
12 - pf_info.result: <% result() %>
13 # [140, 217]
14 task2:
15 action: custompack.create_aws_conn
16 input:
17 log_level: DEBUG
18 account_uuid: [redacted]
19 pop: [redacted]
20 aws_account_id: [redacted]
21 connection_desc: [redacted]
22 pf_port: [redacted]
23 speed: [redacted]
24 vlan: [redacted]
25 zone: [redacted]
26 next:
27 # #fd9d32
28 - do:
29 - task3
30 when: succeeded()
31 publish:
32 - pf_vc_info.result: <% result() %>
33 - pf_vc_info.settings: <% result().settings %>
34 - aws_dx_con_id: <% result().settings.aws_connection_id %>
35 # [116, 336]
36 task3:
37 action: aws.directconnect_confirm_connection
38 input:
39 log_level: DEBUG
40 account_id: <% ctx(aws_account_id) %>
41 connectionId: <% ctx(aws_dx_con_id) %>