Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions docs/source/chatops/aliases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ To remove an action alias, use:

st2 action-alias delete {ALIAS}

After removing or modifying existing aliases, you may need to restart the ``st2chatops`` service,
After removing or modifying existing aliases, you may need to restart the ``st2chatops`` service,
or you may see old or duplicate commands still showing up on your chatbot.

Supported formats
Expand Down Expand Up @@ -127,6 +127,37 @@ For default inputs like JSON, the following pattern can be applied:
It is therefore possible to pass information to a runner like a HTTP header as a default value
using this pattern.


With immutable parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~

Sometimes an alias must have default values that cannot be changed by the chat user.

Using this example:

.. code-block:: yaml

formats:
- "run {{cmd}}"
immutable_parameters:
hosts: localhost

In this case, the action will always receive the hosts parameter as ``localhost``. An attempt to
override this parameter on the message will raise an error.

You can pass any number of arguments to the action using ``immutable_parameters`` and values
support Jinja templating so you can, for example, retrieve a value from the datastore.

.. code-block:: yaml

formats:
- "run {{cmd}}"
immutable_parameters:
hosts: dev.server
sudo_password: "{{ st2kv('system.dev_server_sudo_password', decrypt=true) }}"



Regular Expressions
~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -168,7 +199,7 @@ Additional ChatOps Parameters Passed

An execution triggered via ChatOps will contain variables such as ``action_context.api_user``,
``action_context.user`` and ``action_context.source_channel``. ``api_user`` is the user who runs
the ChatOps command from the client and ``user`` is the |st2| user configured in hubot.
the ChatOps command from the client and ``user`` is the |st2| user configured in hubot.
``source_channel`` is the channel in which the ChatOps command was entered.

If you are attempting to access this information from inside an ActionChain, you will need to
Expand Down