StackStorm / StackStorm/st2

selectively enable timer rule on prod vs dev st2 instance

Open
#3,497 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question status:under discussion
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

I would like to create a rule yaml (using IntervalTimer) in a pack that gets deployed to two different stackstorm instances. The yaml file would be deployed the same on both servers. One server would be used as prod and the other as dev. But I would only want the rule to execute on the prod instance.

If I create the yaml with "enabled: true" it gets enabled on both prod and dev. This is not good because it would run on both based on the timer.

If the yaml has "enabled: false" it will be disabled on "st2ctl reload". If I enable it via the st2 gui, it will later be disabled on the next "st2ctl reload". If I do not define "enabled" at all in the yaml, it defaults to the same behavior as "enabled: false".


I'm told I can't use jinja to control the value of "enabled: " in a rule.

I could instead have the action/workflow the rule calls decide if it should run or abort early.

As a workaround, initially I will deploy the yaml failed named *.yaml.disabled and manually rename this file in production (on first deployment and every rule update) to *.yaml and do an st2ctl reload. Future changes to the file will be again named *.yaml.disabled

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

The issue names rule YAML using IntervalTimer, st2ctl reload, and the st2 GUI, but no source files or tests. Start by tracing how rule enabled state is loaded during reload and changed through the GUI. Done would be a documented per-instance prod/dev mechanism that persists across reloads, with coverage for both deployment contexts.

Written by the indexing model from the issue text.

Assessment

Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.