Skip to content

Immutable/default action parameters for aliases (ChatOps) #1704

@arm4b

Description

@arm4b

There 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:
deploy chatops

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions