StackStorm / StackStorm/st2

Output of slack.post_message not parsing '\n'

Open
#4,299 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug chatops
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Code snippets:

# workflows/list_instances.yaml
      finish:
        action: centro.post_message
        input:
          channel: <% $.channel %>
          module_name: <% $.module_name %>
          environment: <% $.environment %>
          execution_id: <% $.execution_id %>
          user: <% $.user %>
          message: "```<% $.instance_list %>```"
        on-complete:
          - succeed
# chains/post_message.yaml
---
  chain:
    -
      name: "post_message"
      ref: "slack.post_message"
      parameters:
        username: "marvin"
        channel: "{{ channel }}"
        icon_emoji: ":marvin:"
        message: "[{{ module_name }} | {{ environment }} | {{ execution_id }} | {{ user }}] - {{ message }}"

In the previous install of st2, \n characters were honored and produced newlines in the output to slack. In the 2.7.2 release the \n characters get output, munging the output into a single line of output.

ISSUE TYPE

Pick one below and delete the rest:

  • Bug Report
STACKSTORM VERSION

st2 2.7.2, on Python 2.7

OS / ENVIRONMENT / INSTALL METHOD

CentOS Linux release 7.5.1804 (Core)
Installation method:
curl -sSL https://stackstorm.com/packages/install.sh | bash -s -- --user=st2admin --password='REDACTED' --version="${st2_version}"

STEPS TO REPRODUCE

This outputs the same way ever time.

EXPECTED RESULTS

Expected output:

     Instance Id        State       IP Addr          Started         Avail Zone      Type       Environment        Role                 Full Name           
--------------------- ---------- ------------- -------------------- ------------ ------------ --------------- --------------- ------------------------------
i-0ab70a085095ff8f4   running    10.50.13.191  2018-08-08 15:15:54  us-west-2c   m5.large     staging02       biexport-worker biexport-worker-green_staging02
i-0c041493c86994868   running    10.50.12.76   2018-08-08 15:15:39  us-west-2b   m4.xlarge    staging02       cmm_web         cmm-green_staging02           
i-099b501ee05e2eb50   running    10.50.12.8    2018-05-01 03:22:48  us-west-2b   t2.medium    staging02       metabase        metabase-staging02            
ACTUAL RESULTS
     Instance Id        State       IP Addr          Started         Avail Zone      Type       Environment        Role                 Full Name           \n--------------------- ---------- ------------- -------------------- ------------ ------------ --------------- --------------- ------------------------------\ni-0ab70a085095ff8f4   running    10.50.13.191  2018-08-08 15:15:54  us-west-2c   m5.large     staging02       biexport-worker biexport-worker-green_staging02\ni-0c041493c86994868   running    10.50.12.76   2018-08-08 15:15:39  us-west-2b   m4.xlarge    staging02       cmm_web         cmm-green_staging02           \ni-099b501ee05e2eb50   running    10.50.12.8    2018-05-01 03:22:48  us-west-2b   t2.medium    staging02       metabase        metabase-staging02            \n ... 

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.

Research direction

Start with the workflow examples in workflows/list_instances.yaml and chains/post_message.yaml, then trace the slack.post_message entry point used by the chain. Reproduce the behavior with the supplied multiline instance list and verify that escaped \n sequences are rendered as line breaks in Slack output rather than literal text.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.