StackStorm / StackStorm/st2

Action packs.uninstall does not return valid JSON

Open
#4,639 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

SUMMARY

Running st2 run packs.uninstall packs=examples -j does not return well-formed JSON data.

ISSUE TYPE

Bug Report

STACKSTORM VERSION

Paste the output of st2 --version:

st2 3.0dev (2f5fa9b), on Python 2.7.12

OS / ENVIRONMENT / INSTALL METHOD

Installed on Ubuntu 16.04 with st2vagrant.

STEPS TO REPRODUCE
  1. Fire up Ubuntu 16.04 VM with st2vagrant.
  2. Run:
    # sudo cp -r /usr/share/doc/st2/examples/ /opt/stackstorm/packs/
    # st2 run packs.setup_virtualenv packs=examples -j
    # sudo st2ctl reload --register-all
    # st2 run packs.uninstall packs=examples -j
    
EXPECTED RESULTS

Valid JSON.

ACTUAL RESULTS

Invalid JSON:

{
    "action": {
        "ref": "packs.uninstall"
    },
    "end_timestamp": "2019-04-18T02:52:47.720613Z",
    "id": "5cb7e67ca08f813f457b8a25",
    "parameters": {
        "packs": [
            "examples"
        ]
    },
    "result": {
        "exit_code": 0,
        "result": null,
        "stderr": "st2.actions.python.UninstallPackAction: DEBUG    Deleting pack directory \"/opt/stackstorm/packs/examples\"\nst2.actions.python.UninstallPackAction: DEBUG    Deleting virtualenv \"/opt/stackstorm/virtualenvs/examples\" for pack \"examples\"\n",
        "stdout": ""
    },
    "result_task": "delete packs",
    "start_timestamp": "2019-04-18T02:52:44.274245Z",
    "status": "succeeded"
}
[
    {
        "action": "packs.unload",
        "id": "5cb7e67ca08f813fa9f006a3",
        "start_timestamp": "2019-04-18T02:52:44.527055Z",
        "status": "succeeded (1s elapsed)",
        "task": "unregister packs"
    },
    {
        "action": "packs.delete",
        "id": "5cb7e67ea08f813fa9f006a5",
        "start_timestamp": "2019-04-18T02:52:46.645818Z",
        "status": "succeeded (1s elapsed)",
        "task": "delete packs"
    }
]

The object and the array are both well-formed JSON, but simply concatenating them together does not constitute result in valid JSON.

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

Reproduce the issue with st2 run packs.uninstall packs=examples -j and inspect the CLI handling for the packs.uninstall action. Trace how the displayed object and task-status array are serialized, then verify that the command emits one valid JSON document instead of concatenated JSON values.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.