Skip to content

Add "inquiry respond" action and alias#7

Merged
Mierdin merged 1 commit intomasterfrom
add-inquiry-respond-action
Dec 1, 2017
Merged

Add "inquiry respond" action and alias#7
Mierdin merged 1 commit intomasterfrom
add-inquiry-respond-action

Conversation

@Mierdin
Copy link
Copy Markdown
Contributor

@Mierdin Mierdin commented Nov 17, 2017

This PR introduces a new action, st2.inquiry.respond, and an accompanying action-alias for use in chatops. With these, a user can respond to inquiries via chatops (though they will still have to put together the JSON payload themselves).

Usage

The action can certainly be used on its own or in a workflow, using the Inquiry ID and the response payload:

vagrant@st2vagrant:~$ st2 run examples.mistral-ask-basic
.
id: 5a1f4411c4da5f4486b09361
action.ref: examples.mistral-ask-basic
parameters: None
status: pausing
start_timestamp: Wed, 29 Nov 2017 23:34:41 UTC
end_timestamp:
+--------------------------+---------+-------+----------+-------------------------------+
| id                       | status  | task  | action   | start_timestamp               |
+--------------------------+---------+-------+----------+-------------------------------+
| 5a1f4411c4da5f4486b09364 | pending | task1 | core.ask | Wed, 29 Nov 2017 23:34:41 UTC |
+--------------------------+---------+-------+----------+-------------------------------+
vagrant@st2vagrant:~$ st2 inquiry list
+--------------------------+-------+-------+------------+------+
| id                       | roles | users | route      | ttl  |
+--------------------------+-------+-------+------------+------+
| 5a1f4411c4da5f4486b09364 |       |       | developers | 1440 |
+--------------------------+-------+-------+------------+------+
vagrant@st2vagrant:~$ st2 inquiry get 5a1f4411c4da5f4486b09364
+----------+--------------------------------------------------------------+
| Property | Value                                                        |
+----------+--------------------------------------------------------------+
| id       | 5a1f4411c4da5f4486b09364                                     |
| roles    |                                                              |
| users    |                                                              |
| route    | developers                                                   |
| ttl      | 1440                                                         |
| schema   | {                                                            |
|          |     "type": "object",                                        |
|          |     "properties": {                                          |
|          |         "secondfactor": {                                    |
|          |             "required": true,                                |
|          |             "type": "string",                                |
|          |             "description": "Please enter second factor for   |
|          | authenticating to "foo" service"                             |
|          |         }                                                    |
|          |     }                                                        |
|          | }                                                            |
+----------+--------------------------------------------------------------+
vagrant@st2vagrant:~$ st2 run st2.inquiry.respond id=5a1f4411c4da5f4486b09364 response='{"secondfactor": "foo"}'
.
id: 5a1f444ec4da5f4486b09366
status: succeeded
parameters:
  id: 5a1f4411c4da5f4486b09364
  response:
    secondfactor: '********'
result:
  exit_code: 0
  result: null
  stderr: ''
  stdout: ''
vagrant@st2vagrant:~$ st2 inquiry list
+----+-------+-------+-------+-----+
| id | roles | users | route | ttl |
+----+-------+-------+-------+-----+
+----+-------+-------+-------+-----+

In addition, the provided action-alias makes it possible to call this action from Slack (or another chatops-capable application). The result template also provides a bit of feedback to the user on whether or not their response was accepted:

screenshot 2017-11-29 15 53 47

Currently, the UX isn't the greatest, since the user will have to manually construct the JSON payload within their chat program, but it's better than nothing for now.

Dependencies

Some st2 work needed to take place to prepare for this action, so this should not be merged before the below PRs are merged:

Documentation

I opened StackStorm/st2docs#672 to explain the new action and action-alias in the Inquiries section, as well as to explain the masking behavior introduced in StackStorm/st2#3868

Signed-off-by: Matt Oswalt <matt@keepingitclassless.net>
@Mierdin Mierdin force-pushed the add-inquiry-respond-action branch from f093e6b to d52b3a2 Compare November 29, 2017 23:56
@Mierdin Mierdin changed the title [WIP] Add "inquiry respond" action and alias Add "inquiry respond" action and alias Nov 29, 2017
@Mierdin Mierdin requested a review from LindsayHill November 29, 2017 23:58
@Mierdin Mierdin merged commit 73832a2 into master Dec 1, 2017
@Mierdin Mierdin deleted the add-inquiry-respond-action branch December 1, 2017 03:56
nmaludy pushed a commit that referenced this pull request Sep 25, 2020
* ## 1.3.0

- Added `st2.rules.enable`, `st2.rules.disable` actions and chatops commands.
- Added reading `ST2_ACTION_AUTH_API_KEY` environment variable if API Key is not provided in the pack's config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants