Skip to content

Instantly share code, notes, and snippets.

@nzlosh
Created September 29, 2017 22:27
Show Gist options
  • Save nzlosh/c6d357f7891ee4080977536071dda296 to your computer and use it in GitHub Desktop.
Save nzlosh/c6d357f7891ee4080977536071dda296 to your computer and use it in GitHub Desktop.
ActionAlias Matching
ActionChain
-----------
---
chain:
-
name: hello_world
ref: core.local
parameters:
cmd: |
echo '*** \"{{tag_key}}\" \"{{tag_value}}\" \"{{tag_key2}}\" \"{{tag_value2}}\" ***'
default: hello_world
ActionChainMeta
---------------
---
description: Execute an echo variables.
enabled: true
entry_point: 'chains/notify_errbot.yaml'
name: notify_errbot
runner_type: "action-chain"
parameters:
tag_key:
required: true
type: string
tag_value:
required: true
type: string
tag_key2:
required: false
type: string
tag_value2:
required: false
type: string
ActionAlias
-----------
---
name: "notify_errbot_test"
description: "Triggers an errbot notification."
action_ref: "test.notify_errbot"
pack: test
enabled: true
formats:
- "test notify {{tag_key}} {{tag_value}} {{tag_key2}} {{tag_value2}}"
- "test notify {{tag_key}} {{tag_value}}"
ack:
format: "The test is starting .. if you don't see a result soon, things are probably broken."
result:
format: "{{ execution.result.tasks }}"
Errbot
------
ch [10:51 PM]
.st2help
prime [10:51 PM]
.st2 test notify {{tag_key}} {{tag_value}} {{tag_key2}} {{tag_value2}} - Triggers an errbot notification.
.st2 test notify {{tag_key}} {{tag_value}} - Triggers an errbot notification.
ch [10:51 PM]
.st2 test notify key1 val1
prime [10:51 PM]
The test is starting .. if you don't see a result soon, things are probably broken.
[10:51]
Action core.local completed.
status : succeeded
execution: 59ceb259dc599a6158e534ed Show more…
[10:51]
[{u'liveaction_id': u'59ceb259dc599a6158e534ec', u'workflow': None, u'created_at': u'2017-09-29T20:51:37.440135+00:00', u'updated_at': u'2017-09-29T20:51:38.558647+00:00', u'state': u'succeeded', u'result': {u'succeeded': True, u'failed': False, u'return_code': 0, u'stderr': u'', u'stdout': u'*** "key1" "val1" "None" "None" ***'}, u'id': u'hello_world', u'execution_id': u'59ceb259dc599a6158e534ed', u'name': u'hello_world'}]
ch [10:52 PM]
.st2 test notify key1 value1 key2 value2
prime [10:52 PM]
st2 command 'test notify key1 value1 key2 value2' not found. View available commands with .st2help.
st2client
---------
# st2 action-alias match 'test notify key1 value1'
+--------------------+----------------------------------+
| name | description |
+--------------------+----------------------------------+
| notify_errbot_test | Triggers an errbot notification. |
+--------------------+----------------------------------+
# st2 action-alias match 'test notify key1 value1 key2 value2'
ERROR: 400 Client Error: Bad Request
MESSAGE: Command 'test notify key1 value1 key2 value2' matched more than 1 pattern for url: http://127.0.0.1:9101/v1/actionalias/match
# st2 --version
st2 2.5dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment