Feature: Add "st2 rule search", "st2 action search" to CLI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
I quite regularly (almost daily) have to pop into MongoDB to search for specific rules or actions. This is because we have far too many of each to do "st2 rule list | grep", they're all in one pack, and they have a predictable naming scheme. To detail our use case a bit more, we have a cron pack where we keep a ton of rules with many named like <app>_<start|stop>_<hostname>. The existing list filters for pack, action, and trigger aren't super helpful in this scenario. So I tend to use mongo to search for hostname, or for the app name, or for app_start, etc., for a particular rule, action, or (occasionally) action execution.
db.rule_d_b.find({"uid":/.*some-search-string.*/},{"uid":1,"_id":0}).count()
I'm going to write a little helper script so others on my team have this functionality at-hand, but thought a feature request might make it part of core and helper others too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing st2 rule list and st2 action list CLI entry points, then trace how their filters reach MongoDB. Done means both new commands support searching rule and action names for terms such as hostnames or app names, with behavior covered by the project's relevant CLI tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- cli, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100