Immutable/default action parameters for aliases (ChatOps)
See original GitHub issueThere is already mechanism to set optional parameter in alias:
formats:
- "google {{query=StackStorm}}"
Problem
But what if we want to add simple hardcoded chatops command and hide unneeded logic behind the default/immutable action parameters? I think that good ChatOps commands could be simple and easy to remember, without MANY optional parameters. Example case:
To do that, we need to create additional action with default parameters, which will trigger another action. I do this way almost everywhere (bad way): https://github.com/armab/st2-chatops-aliases/tree/master/actions
Proposal
The proposal is to allow setting from alias default/immutable action parameters.
Here is an example how it could look:
---
name: chatops.deploy
action_ref: packs.install
description: Deploy ChatOps pack from `armab/st2-ansible-chatops` GitHub repo
formats:
- "deploy chatops"
# these lines were added
# naming/structure is doubtful, but you got the idea
action_parameters:
packs: "st2-ansible-chatops"
repo_url: "armab/st2-ansible-chatops"
Here you can see that behind simple and immutable/hardcoded ChatOps command:
!deploy chatops
stands:
st2 run packs.install packs=st2-ansible-chatops repo_url=armab/st2-ansible-chatops
This simplifies things a lot, making existing actions more reusable by aliases.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:11
- Comments:25 (22 by maintainers)
Top GitHub Comments
Hi,
I have a similar use case.
I have an action alias I would like to be able have users call, that uses the same parameter values.
The proposed “action-parameters” would solve my use case perfectly.
Same use case here, pretty much:
When using chatops, I started defining certain action aliases. One alias I set up was basically
deploy app
, that in turn would trigger anansible-playbook
action with certain parameters.Those parameters are static (playbook X, folder Y) and shouldn’t be changed with user input.
I was then surprised to find that action aliases do not support default/static parameters. You can define in the format such as
deploy web {{playbook="someplay"}}
but there are valid use-cases for simply having static parameters being passed to the action. Having a default in the format looks like a workaround for the time being but that’s all that it is.I think Action Aliases could benefit from something like
action_parameters
where we define certain parameters to be passed to the action that do not depend on user input and should not be changed.