StackStorm / StackStorm/st2

Remove nonexistent actions from database when upgrading/downgrading a pack

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

Nobody has claimed this yet.

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

Description

SUMMARY

Actions are not removed when upgrading/downgrading packs.

ISSUE TYPE
  • Bug Report
STACKSTORM VERSION

Paste the output of st2 --version:
st2 3.0dev (7524cc8), on Python 2.7.12
(on st2cicd037)

OS / ENVIRONMENT / INSTALL METHOD

Ubuntu 16.04.5 LTS
Installed via st2cicd.build-controller

STEPS TO REPRODUCE
  1. Install most recent version of AWS pack.
  2. Note all of the actions, specifically the aws.ec2_describe_instances action exists and is runnable from the Actions tab in the web UI and from a workflow task.
  3. Install AWS pack from the v0.10.0 or v0.10.1 tags using st2 pack install ... WITHOUT running st2 pack remove aws.
  4. Note all of the actions, specifically the aws.ec2_describe_instances action still exists, and is even runnable from the Actions tab in the web UI.
  5. Create a workflow that calls aws.ec2_describe_instances from a task. Note the incomprehensible error.

Action metadata:

---
name: remote_windows
runner_type: orquesta
description: ...
enabled: true
entry_point: workflows/remote_windows.yaml
parameters:
  instance_id:
    type: string
    description: EC2 instance ID

Workflow:

---
version: '1.0'
description: Remote into a Windows EC2 instance
input:
  - instance_id
tasks:
  get_instance:
    action: aws.ec2_describe_instances
    input:
      InstanceIds: <% ctx().instance_id %>
EXPECTED RESULTS

A better error message is desirable, but it is probably easier to simply remove all actions that exist in the database but not in an action metadata file when running st2 pack install ....

ACTUAL RESULTS

An incomprehensible error:

{
  "output": null,
  "errors": [
    {
      "message": "SyntaxError: unexpected EOF while parsing (<unknown>, line 0)",
      "type": "error",
      "task_id": "get_instance"
    }
  ]
}

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 at the st2 pack install entry point and trace how action metadata is handled when upgrading or downgrading a pack. Reproduce with the AWS pack versions described, then verify that actions absent from the installed metadata are removed from the database and that workflows no longer resolve them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.