question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Immutable/default action parameters for aliases (ChatOps)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:11
  • Comments:25 (22 by maintainers)

github_iconTop GitHub Comments

7reactions
namachielicommented, Feb 2, 2018

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.

action_ref: "servicenow.get"
description: "list unassigned Tickets in the Network team's Queue"
formats:
  - display: "list unassigned servicenow"
    representation:
    - "(unassigned|network|network team|networking|ticket|tickets).*(servicenow|service now|service-now|tickets)"
action-parameters:
  query: {\"active:\"true\",\"assignment_group\":\"aebf964c4f8a3e00c92a2cee0210c734\"\"assigned_to\":\"^state!=6^EQ\"
  table: "incident"
4reactions
nicholasamorimcommented, Jun 4, 2019

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 an ansible-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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Action Aliases — StackStorm 3.8.0 documentation
With immutable parameters​​ Sometimes an alias must have default values that cannot be changed by the chat user. In this case, the action...
Read more >
Add a simple custom action and action alias to stackstorm
In this post I will demonstrate adding a ping action to stackstorm. Then make that action available from chatops (slack) using an action...
Read more >
Ansible and ChatOps or how to manage 100+ chat servers
One of the features of StackStorm is the ability to create simple aliases / wrappers around teams, making it easier to work with...
Read more >
https://raw.githubusercontent.com/StackStorm/st2/m...
For example: ``` st2 --debug action list -p chatops 2017-04-05 00:56:01,935 ... description: Update action alias parameters: - name: ref_or_id in: path ...
Read more >
Sterling Connect:Direct for z/OS Process Parameters - IBM
specifies whether aliases are copied when their associated member names are copied. The default is ALIAS=Y. Guidelines for alias entries when ALIAS=Y follow ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found