StackStorm / StackStorm/st2

Actions with immutable=true, default set and enum cannot be run from UI

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

Nobody has claimed this yet.

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

Description

SUMMARY

While trying to run example from https://github.com/StackStorm/st2/blob/ddd3aba57d8cccaaaef64babd07dd48e0b68c42a/contrib/examples/actions/weather.yaml from the web UI I ran into an issue when the call to API would fail with

{
    "faultstring": "Override of immutable parameter(s) [u'method'] is unsupported."
}

Running the same action from CLI worked just fine. Also, removing enum helps.

ISSUE TYPE
  • Bug Report
STACKSTORM VERSION

Paste the output of st2 --version:

st2 2.9.0, on Python 2.7.10

OS / ENVIRONMENT / INSTALL METHOD

RPM packages on CentOS 6.

STEPS TO REPRODUCE
---
description: Look up weather via http://openweathermap.org
# Free weather API is provided under the terms of the Creative Commons Attribution-ShareAlike 4.0 Generic License.
# Terms of service http://openweathermap.org/terms
enabled: true
entry_point: ''
name: weather
parameters:
  auth:
    type: string
  headers:
    type: object
  method:
    default: GET
    type: string
    enum:
    - GET
    - POST
    - PUT
    - DELETE
    immutable: true
  params:
    type: string
  timeout:
    default: 60
    type: integer
  url:
    default: http://api.openweathermap.org/data/2.5/weather?q={{zip}}&units=imperial
    immutable: true
    type: string
  zip:
    type: string
runner_type: "http-request"

Going to st2 web and trying to execute this action fails. The UI is adding method: GET into params passed to st2api, which it rejects with the explanation shown above and below.

EXPECTED RESULTS

Expect it to be run successfully both from the UI and CLI.

ACTUAL RESULTS

Got 400 Bad Request with

{
    "faultstring": "Override of immutable parameter(s) [u'method'] is unsupported."
}

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 contrib/examples/actions/weather.yaml and reproduce the request from st2 web, then compare it with the CLI invocation and the st2api response. Trace where the UI adds the default enum value for immutable method; done means the weather action runs successfully from both UI and CLI without the immutable-override 400.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.