StackStorm / StackStorm/st2

Can't access action.stdout in 'notify' scope

Open
#3,403 5 comments 1 reaction 1 assignee View on GitHub

@Kami is already working on this.

Since May 22, 2017.

complexity:medium enhancement feature
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

I'm trying to build action-chain workflow and I have a desire to use action.stdout within notify scope.
notify scope is the way to notify other systems (slack/hipchat) about action that just happened.
The thing is that apparently the variable is not accessible inside the notify scope, I just get {{some-variable}} name and not the variable content.

Example:

       -
        name: "check_down_endpoints"
        ref: "cassandra.check_down_endpoints"
        parameters:
            consul_servicename: '{{alert_body.commonLabels.servicename}}'
        on-failure: "fail_on_more_than_one_node"
        notify:
          on-success:
              routes:
                - hipchat
              message: "[StackStorm][SUCCESS] Workflow bla bla passed"
    -

        name: "Second-Action"
        ref: "core.remote_sudo"
        parameters:
            cmd: "<some command in here>"
            hosts: "{{check_down_endpoints.stdout.node}}"
            timeout: 1200
        on-success: "check"
        on-failure: "fail"
        notify:
          on-failure:
            routes:
              - hipchat
            message: "fail: {{action_parameters.hosts}}"
    -

When trying to get access to variable {{check_down_endpoints.stdout}} in here, I just get the variable name itself with brackets.

If this is meant to be it's really disappointing, there is a way to workaround that?
By the way didn't find what more action_context variables that is available - to those vars I can reach.
Also action_parameters are accessible so its good but still lack of information like stdout of other actions.

        notify:
          on-failure:
            routes:
              - hipchat
            message: "fail: {{check_down_endpoints.stdout}}"

message output in chat: "fail: {{check_down_endpoints.stdout}}"
Not the variable content as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.