StackStorm / StackStorm/st2

sensor with parameters

Open
#5,866 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,
When I tried to create a new sensor with an optionnal parameter.

I created a new rule without parameter, it works.
But when I tried to set a parameters, the st2rulesengine doesn't found the rule defined.

My sensor:

---
class_name: "WatchTickets"
entry_point: "watch_tickets.py"
description: "Test sensor that emits triggers."
poll_interval: 30
trigger_types:
  - name: "watch_tickets"
    description: "An example trigger."
    parameters_schema:
      type: "object"
      properties:
        delta:
          type: "number"
      additionalProperties: false
    payload_schema:
      type: "object"
      properties:
        ticket_id:
          type: "number"

My rule:

---
name: "rules.merge.watch_tickets"
pack: "example"
description: "Watch open tickets assigned"
enabled: true

trigger:
  type: "test.watch_tickets"
  parameters:
    delta: 15
action:
  ref: "core.echo"
  parameters:
    message: "{{ trigger.ticket_id }}"

Do you have a solution ?

st2 3.7.0, on Python 3.8.10

Thanks!

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 by reproducing the issue with the WatchTickets sensor configuration, its watch_tickets.py entry point, and the rules.merge.watch_tickets rule on StackStorm 3.7.0 with Python 3.8.10. Trace how st2rulesengine resolves trigger parameters; done means the parameterized rule is found and the action receives the ticket_id as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.