Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement runner, API, and client code for Inquiries #3653

Merged
merged 139 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
ca325d3
Initial WIP copy of st2 ask runner
Jun 30, 2017
75d252c
Added missing params, changed name to Inquirer
Jul 7, 2017
0cae2ef
Merge branch 'master' into ask-runner
Jul 7, 2017
5a54c78
Updated runner implementation
Jul 7, 2017
272c637
Add newline to meta
Jul 7, 2017
1b98124
Remove note about handling st2.respond.
Jul 7, 2017
9ef6fdc
Add high-level note back in as docstring
Jul 7, 2017
6a72da4
Remove extra line
Jul 9, 2017
ba56521
Merge branch 'master' into ask-runner
Mierdin Jul 11, 2017
922df5c
Fix roles and users params; add example of retrieving status from result
Jul 20, 2017
328c4c8
Merge branch 'master' into ask-runner
Mierdin Aug 1, 2017
c406e96
Added example workflows
Mierdin Aug 3, 2017
a7a1d54
Added 'ask' action
Mierdin Aug 3, 2017
ff7dd28
Implemented most of the runner and some of the back-end code
Mierdin Aug 3, 2017
4726398
Fixed trigger dispatch
Mierdin Aug 3, 2017
a6df0de
Added additional fields to trigger payload
Mierdin Aug 3, 2017
2275a80
Removed unnecessary BASE_DIR variable
Mierdin Aug 3, 2017
adc0074
Reorder logic so that request_pause is last
Mierdin Aug 3, 2017
11977ee
Add additional fields to trigger payload schema
Mierdin Aug 3, 2017
de7d303
Removed validation call
Mierdin Aug 4, 2017
7cde3c5
Make sure to return something other than empty dict if no parent
Mierdin Aug 4, 2017
ed65cc7
Merge branch 'master' into ask-runner
Mierdin Aug 4, 2017
592b224
Removed unnecessary successful status
Mierdin Aug 4, 2017
43f29ed
Added unit test for runner
Mierdin Aug 4, 2017
ff7a274
Added test for failure on no parent
Mierdin Aug 4, 2017
892a5e4
Added integration directory to appease CI
Mierdin Aug 4, 2017
ae8a545
Added symlink to runner in st2tests fixtures
Mierdin Aug 4, 2017
741aad1
Added pending status to mistral_v2 callback
Mierdin Aug 4, 2017
128b229
Updated runner count in st2api tests
Mierdin Aug 4, 2017
1800b66
Updated runner count in st2api tests again - missed one
Mierdin Aug 4, 2017
3bde365
Merge branch 'master' into ask-runner
Mierdin Aug 4, 2017
21c12c3
Removed request_pause stub function and added appropriate mocks to te…
Mierdin Aug 4, 2017
4e999e2
Added more granularily to trigger dispatch check to ensure params are…
Mierdin Aug 4, 2017
b3a84cf
Removed comment
Mierdin Aug 5, 2017
b63a3d7
Removed unnecessary newline
Mierdin Aug 5, 2017
9dc3868
Removed error when no parent execution exists
Mierdin Aug 8, 2017
c1c93da
Added more detail to the inquiry trigger payload schema
Mierdin Aug 8, 2017
c308fc9
Added new endpoint to openapi def
Mierdin Aug 7, 2017
9b7b645
Implemented skeleton controller with some english notes on what it wi…
Mierdin Aug 7, 2017
ae74044
More changes - in particular, added get and get_all
Mierdin Aug 7, 2017
7f13799
Managed to get the functions working via the API
Mierdin Aug 8, 2017
229852c
Remove examples
Mierdin Aug 8, 2017
6bc7ee3
API updates - got PUT working
Mierdin Aug 8, 2017
3147f39
Add ID field, make response_data required
Mierdin Aug 8, 2017
2998d6e
Added more detail to schema for Inquiry
Mierdin Aug 9, 2017
c163353
Working out the PUT method (WIP)
Mierdin Aug 9, 2017
2992c8c
Moved controller code to exp
Mierdin Aug 9, 2017
4e16f12
WIP st2client changes
Mierdin Aug 10, 2017
cdf2159
Got inquiry get command working
Mierdin Aug 10, 2017
3beb0cf
Got inquiry respond working
Mierdin Aug 10, 2017
aa1c016
now retrieving ACTUAL list of inquiries
Mierdin Aug 11, 2017
be4c70a
Got get_one inquiry working
Mierdin Aug 11, 2017
3c9a147
updating liveaction with result and new status
Mierdin Aug 11, 2017
0388529
Renamed response_data to response
Mierdin Aug 11, 2017
78c1129
Merge branch 'ask-runner' into api-ask-response
Mierdin Aug 11, 2017
a84ac5e
Merge branch 'master' into ask-runner
Mierdin Aug 24, 2017
6b2205c
Merge branch 'ask-runner' into api-ask-response
Mierdin Aug 24, 2017
5e64028
Removed unnecessary test functions for pause and resume
Mierdin Aug 24, 2017
7ad63ea
Updated example workflow
Mierdin Aug 24, 2017
8c22012
Updated request_pause call now that its implemented
Mierdin Aug 24, 2017
a5b2347
Merge branch 'ask-runner' into api-ask-response
Mierdin Aug 24, 2017
ded5762
Implement jsonsschema validation, and use self._transform_inquiry() f…
Mierdin Aug 24, 2017
7964937
Merge branch 'master' into ask-runner
Mierdin Aug 25, 2017
fb8d87e
Merge branch 'ask-runner' into api-ask-response
Mierdin Aug 25, 2017
38f2acc
Cleanup and adding resume functionality
Mierdin Aug 25, 2017
e5516b8
WIP - moving things around
Mierdin Aug 26, 2017
c5cd023
Add function for recursively finding parent
Mierdin Aug 27, 2017
6e0872d
Update openapi def
Mierdin Aug 27, 2017
b979824
Add logic to exclude workflows from get_all
Mierdin Aug 27, 2017
480444a
Fix parent workflow
Mierdin Aug 29, 2017
7ca001f
Moved response permissions to _can_respond function
Mierdin Aug 29, 2017
aa68ae6
Merge branch 'master' into api-ask-response
Mierdin Aug 29, 2017
907aa05
Update changelog
Mierdin Aug 29, 2017
e17f063
Cleaned up old comments and reorganized functions
Mierdin Aug 29, 2017
10b4ac6
finished renaming iid to inquiry_id
Mierdin Aug 29, 2017
889e6a1
Added check to get_one that ensures ID is an Inquiry
Mierdin Aug 29, 2017
78fd63f
Cleaned up client, added limit option
Mierdin Aug 30, 2017
8c71a27
Implement RBAC for Inquiries
Mierdin Aug 30, 2017
723c7d9
Fix rdata name, change to response_data
Mierdin Aug 31, 2017
4f1097f
Updates to descriptions
Mierdin Aug 31, 2017
89fa487
Added ttl field to Inquirer runner
Mierdin Aug 31, 2017
87931a0
Automatically retrieve default values from runner params for all fields
Mierdin Aug 31, 2017
90a290f
Provide 'response' directly instead of 'result'
Mierdin Sep 1, 2017
c05bfbf
Add ttl field to openapi spec
Mierdin Sep 1, 2017
92cd084
Make all fields required for inquiry trigger payloads
Mierdin Sep 1, 2017
109f364
Return result as second value from transform function
Mierdin Sep 2, 2017
9391be8
Improved retrieval of inquiries via status and runner type
Mierdin Sep 3, 2017
128dfb0
Switch order of checks in 'put' function
Mierdin Sep 3, 2017
b4748aa
Significant changes to parameters, and result
Mierdin Sep 4, 2017
c0d680b
Only request resume if inquiry has a parent
Mierdin Sep 4, 2017
70da2f5
Added RBAC assertions where I thought it made sense
Mierdin Sep 4, 2017
21f23ce
Improve descriptions for example workflows
Mierdin Sep 4, 2017
0408c7b
Fixed some broken RBAC things after doing some more testing
Mierdin Sep 6, 2017
5647e57
Fix typo in docstring
Mierdin Sep 6, 2017
3416605
Merge branch 'master' into api-ask-response
Mierdin Sep 6, 2017
60029ea
Revise changelog entry
Mierdin Sep 6, 2017
97aa2c5
Clean up old experimental stuff in rbac test
Mierdin Sep 6, 2017
aa7b1d4
Added default schema to runner, use new required field in schema
Mierdin Sep 11, 2017
dd61fd4
Added unit tests for API
Mierdin Sep 8, 2017
d08ff28
Merge branch 'wip-tests' into api-ask-response
Mierdin Sep 12, 2017
920e88f
Implement new API models for Inquiries
Mierdin Sep 18, 2017
9d255c5
Change name of response result to be less confusing
Mierdin Sep 19, 2017
e4ab739
Ensure "result" remains in Inquiry, simplify retrieval
Mierdin Sep 19, 2017
984fe1f
Added limit note for 'inquiry list'
Mierdin Sep 20, 2017
fee4118
Improve ttl field description
Mierdin Sep 20, 2017
4135836
Added RBAC permission to schema for inquiry get_all
Mierdin Sep 20, 2017
2e54dd3
Added consts, added utility method for checking Inquiries
Mierdin Sep 20, 2017
39a17fa
Refactor permissions logic to be a bit clearer
Mierdin Sep 21, 2017
310db0e
Fixed issue with extra inquiry subcommands
Mierdin Sep 21, 2017
f4da7cf
Changed inquiry field retrieval to .get()
Mierdin Sep 21, 2017
aa9a437
Added interactive mode (default) to client respond
Mierdin Sep 21, 2017
fb55f32
Clean up client response code a bit
Mierdin Sep 21, 2017
79f31e6
Add RBAC-enabled API tests
Mierdin Sep 22, 2017
190aed8
Added test for more complicated schema in inquiry api
Mierdin Sep 22, 2017
e8e5e6e
Move inquiry respond to InteractiveForm
Mierdin Sep 22, 2017
0c0ece2
Add tests for inquiry client commands
Mierdin Sep 22, 2017
56075d4
Merge branch 'master' into api-ask-response
Mierdin Sep 22, 2017
b588b14
Use action constant for inquiry status in API
Mierdin Sep 23, 2017
e618dee
Use old 'required' format in schemas more consistently; use internal …
Mierdin Sep 25, 2017
c061616
Add on-success statement to example actionchain
Mierdin Sep 26, 2017
479a997
Move mocks to class-level for runner test
Mierdin Sep 27, 2017
4b27228
Removed old comment in inquirer runner
Mierdin Sep 27, 2017
be287e7
Simplify conversion functions for Inquiry API models
Mierdin Sep 27, 2017
ae4a81a
Improve error message when not permitted to respond to inquiry
Mierdin Sep 27, 2017
577d019
Moved abort call outside of sanity check function
Mierdin Sep 27, 2017
5596bfa
Override ResourceController._get_one_by_id to contain scope of Inquir…
Mierdin Sep 27, 2017
5c9be24
Add test for get_root_liveaction
Mierdin Sep 27, 2017
7d828a2
Changed Inquiry RBAC permissions to global
Mierdin Sep 28, 2017
545e3b6
Removed everything but 'id' from inquiry trigger
Mierdin Sep 28, 2017
d17ad68
Rename 'tag' paramter to 'route'
Mierdin Sep 28, 2017
f5faf51
Added route back in to inquiry trigger
Mierdin Sep 28, 2017
66d4dab
Updated descriptions for Inquiry permissions
Mierdin Sep 29, 2017
b8a1c13
Add permission inheritance for inquiries from parent workflow
Mierdin Sep 29, 2017
d801f71
Merge branch 'master' into api-ask-response
Mierdin Sep 30, 2017
26069f9
Fix rbac API tests based on recent upstream changes
Mierdin Sep 30, 2017
1fd73ba
Fixed bug in ActionChain runner where context_result wasn't updated p…
Mierdin Oct 2, 2017
a98c83b
Add parent workflows for testing inquiries in actionchains
Mierdin Oct 2, 2017
868fab2
Updated inquiry workflows to retrieve data from response payload
Mierdin Oct 2, 2017
57e9b8f
Merge branch 'master' into api-ask-response
Mierdin Oct 3, 2017
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
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ Added
#3763
* Add new Jinja filters ``from_json_string``, ``from_yaml_string``, and ``jsonpath_query``.
#3763

* Add new "Inquiry" capability, which adds ability to "ask a question", usually in a workflow.
Create a new runner type: "inquirer" to support this, as well as new API endpoints and
client commands for interacting with Inquiries

Contributed by mierdin. #3653

Fixed
~~~~~

Expand Down
5 changes: 5 additions & 0 deletions contrib/core/actions/ask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "ask"
runner_type: "inquirer"
description: "Action for initiating an Inquiry (usually in a workflow)"
enabled: true
6 changes: 6 additions & 0 deletions contrib/examples/actions/chain-test-inquiry-parent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: chain-test-inquiry-parent
description: A workflow to test Inquiry pausing nested actionchain workflows
runner_type: action-chain
entry_point: chains/chain_test_inquiry_parent.yaml
enabled: true
6 changes: 6 additions & 0 deletions contrib/examples/actions/chain-test-inquiry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: chain-test-inquiry
description: A basic ActionChain workflow illustrating the use of Inquiries
runner_type: action-chain
entry_point: chains/chain_test_inquiry.yaml
enabled: true
19 changes: 19 additions & 0 deletions contrib/examples/actions/chains/chain_test_inquiry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
chain:

- name: task1
ref: core.ask
params:
route: developers
schema:
type: object
properties:
secondfactor:
type: string
description: Please enter second factor for authenticating to "foo" service
required: True
on-success: "task2"

- name: task2
ref: core.local
params:
cmd: echo "We can now authenticate to "foo" service with {{ task1.result.response.secondfactor }}"
10 changes: 10 additions & 0 deletions contrib/examples/actions/chains/chain_test_inquiry_parent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
chain:

- name: task1
ref: examples.chain-test-inquiry
on-success: "task2"

- name: task2
ref: core.local
params:
cmd: echo "parent task2"
7 changes: 7 additions & 0 deletions contrib/examples/actions/mistral-ask-basic.meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
description: A basic Mistral workflow illustrating the use of Inquiries
enabled: true
entry_point: workflows/mistral-ask-basic.yaml
name: mistral-ask-basic
pack: examples
runner_type: mistral-v2
8 changes: 8 additions & 0 deletions contrib/examples/actions/mistral-ask-parent.meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
description: >
Workflow for demonstrating "ask" functionality
enabled: true
entry_point: workflows/mistral-ask-parent.yaml
name: mistral-ask-parent
pack: examples
runner_type: mistral-v2
26 changes: 26 additions & 0 deletions contrib/examples/actions/workflows/mistral-ask-basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '2.0'

examples.mistral-ask-basic:
description: A basic Mistral workflow illustrating the use of Inquiries
type: direct
output:
result: <% task(task1).result.response %>
tasks:
task1:
action: core.ask
input:
route: developers
schema:
type: object
properties:
secondfactor:
type: string
description: Please enter second factor for authenticating to "foo" service
required: True
on-success:
- task2

task2:
action: core.local
input:
cmd: echo "We can now authenticate to 'foo' service with <% task(task1).result.response.secondfactor %>"
10 changes: 10 additions & 0 deletions contrib/examples/actions/workflows/mistral-ask-parent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '2.0'

examples.mistral-ask-parent:
description: A workflow for testing core.ask's ability to pause nested workflows
type: direct
output:
result: <% task(task1).result.result %>
tasks:
task1:
action: examples.mistral-ask-basic
14 changes: 14 additions & 0 deletions contrib/examples/rules/notify_inquiry_developers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: "notify_inquiry_developers"
pack: "examples"
description: Notify developers of an Inquiry action
enabled: false

trigger:
type: core.st2.generic.inquiry

action:
ref: slack.post_message
parameters:
channel: "#{{ trigger.route }}"
message: 'Inquiry {{trigger.id}} is awaiting an approval action'
5 changes: 5 additions & 0 deletions contrib/runners/action_chain_runner/action_chain_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ def _run_chain(self, action_parameters, resuming=False):
del result['tasks'][-1]
result['tasks'].append(updated_task_result)

# Also need to update context_result so the updated result
# is available to Jinja expressions
updated_task_name = updated_task_result['name']
context_result[updated_task_name]['result'] = updated_task_result['result']

# If the last task was canceled, then canceled the chain altogether.
if liveaction.status == action_constants.LIVEACTION_STATUS_CANCELED:
chain_status = action_constants.LIVEACTION_STATUS_CANCELED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from st2common.services import action as action_service
from st2common.transport.liveaction import LiveActionPublisher
from st2common.transport.publishers import CUDPublisher
from st2common.util import action_db as action_utils

from st2tests import DbTestCase
from st2tests import fixturesloader
Expand All @@ -37,6 +38,7 @@
TEST_FIXTURES = {
'chains': [
'test_pause_resume.yaml',
'test_pause_resume_context_result',
'test_pause_resume_with_published_vars.yaml',
'test_pause_resume_with_error.yaml',
'test_pause_resume_with_subworkflow.yaml',
Expand All @@ -47,6 +49,7 @@
],
'actions': [
'test_pause_resume.yaml',
'test_pause_resume_context_result',
'test_pause_resume_with_published_vars.yaml',
'test_pause_resume_with_error.yaml',
'test_pause_resume_with_subworkflow.yaml',
Expand Down Expand Up @@ -728,3 +731,56 @@ def test_chain_pause_resume_last_task_failed_with_no_next_task(self):
liveaction.result['tasks'][0]['state'],
action_constants.LIVEACTION_STATUS_FAILED
)

def test_chain_pause_resume_status_change(self):
"""Tests context_result is updated when last task's status changes between pause and resume
"""

# A temp file is created during test setup. Ensure the temp file exists.
# The test action chain will stall until this file is deleted. This gives
# the unit test a moment to run any test related logic.
path = self.temp_file_path
self.assertTrue(os.path.exists(path))

action = TEST_PACK + '.' + 'test_pause_resume_context_result'
params = {'tempfile': path}
liveaction = LiveActionDB(action=action, parameters=params)
liveaction, execution = action_service.request(liveaction)
liveaction = LiveAction.get_by_id(str(liveaction.id))

# This workflow runs 'core.ask' so will pause on its own. We just need to
# wait until the liveaction is pausing.
liveaction = self._wait_for_status(liveaction, action_constants.LIVEACTION_STATUS_PAUSING)
self.assertEqual(liveaction.status, action_constants.LIVEACTION_STATUS_PAUSING)

# Delete the temporary file that the action chain is waiting on.
os.remove(path)
self.assertFalse(os.path.exists(path))

# Wait until the liveaction is paused.
liveaction = self._wait_for_status(liveaction, action_constants.LIVEACTION_STATUS_PAUSED)
self.assertEqual(liveaction.status, action_constants.LIVEACTION_STATUS_PAUSED)

# Wait for non-blocking threads to complete. Ensure runner is not running.
MockLiveActionPublisherNonBlocking.wait_all()

last_task_liveaction_id = liveaction.result['tasks'][-1]['liveaction_id']
action_utils.update_liveaction_status(
status=action_constants.LIVEACTION_STATUS_SUCCEEDED,
result={'foo': 'bar'},
liveaction_id=last_task_liveaction_id)

# Request action chain to resume.
liveaction, execution = action_service.request_resume(liveaction, USERNAME)

# Wait until the liveaction is completed.
liveaction = self._wait_for_status(liveaction, action_constants.LIVEACTION_STATUS_SUCCEEDED)
self.assertEqual(liveaction.status, action_constants.LIVEACTION_STATUS_SUCCEEDED)

# Wait for non-blocking threads to complete.
MockLiveActionPublisherNonBlocking.wait_all()

# Check liveaction result.
self.assertIn('tasks', liveaction.result)
self.assertEqual(len(liveaction.result['tasks']), 2)
self.assertEqual(liveaction.result['tasks'][0]['result']['foo'], 'bar')
112 changes: 112 additions & 0 deletions contrib/runners/inquirer/inquirer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import uuid

from st2common import log as logging
from st2common.constants.action import LIVEACTION_STATUS_PENDING
from st2common.constants.triggers import INQUIRY_TRIGGER
from st2common.models.system.common import ResourceReference
from st2common.persistence.execution import ActionExecution
from st2common.runners.base import ActionRunner
from st2common.services import action as action_service
from st2common.transport.reactor import TriggerDispatcher
from st2common.util import action_db as action_utils

LOG = logging.getLogger(__name__)

__all__ = [
'get_runner',
'Inquirer',
]

# constants to lookup in runner_parameters.
RUNNER_SCHEMA = 'schema'
RUNNER_ROLES = 'roles'
RUNNER_USERS = 'users'
RUNNER_ROUTE = 'route'
RUNNER_TTL = 'ttl'

DEFAULT_SCHEMA = {
"title": "response_data",
"type": "object",
"properties": {
"continue": {
"type": "boolean",
"description": "Would you like to continue the workflow?",
"required": True
}
}
}


def get_runner():
return Inquirer(str(uuid.uuid4()))


class Inquirer(ActionRunner):
"""This runner implements the ability to ask for more input during a workflow
"""

def __init__(self, runner_id):
super(Inquirer, self).__init__(runner_id=runner_id)
self.trigger_dispatcher = TriggerDispatcher(LOG)

def pre_run(self):
super(Inquirer, self).pre_run()

# TODO :This is awful, but the way "runner_parameters" and other variables get
# assigned on the runner instance is even worse. Those arguments should
# be passed to the constructor.
self.schema = self.runner_parameters.get(RUNNER_SCHEMA, DEFAULT_SCHEMA)
self.roles_param = self.runner_parameters.get(RUNNER_ROLES, [])
self.users_param = self.runner_parameters.get(RUNNER_USERS, [])
self.route = self.runner_parameters.get(RUNNER_ROUTE, "")
self.ttl = self.runner_parameters.get(RUNNER_TTL, 1440)

def run(self, action_parameters):

liveaction_db = action_utils.get_liveaction_by_id(self.liveaction_id)
exc = ActionExecution.get(liveaction__id=str(liveaction_db.id))

# Assemble and dispatch trigger
trigger_ref = ResourceReference.to_string_reference(
pack=INQUIRY_TRIGGER['pack'],
name=INQUIRY_TRIGGER['name']
)
trigger_payload = {
"id": str(exc.id),
"route": self.route
}
self.trigger_dispatcher.dispatch(trigger_ref, trigger_payload)

# We only want to request a pause if this has a parent
if liveaction_db.context.get("parent"):

# Get the root liveaction and request that it pauses
root_liveaction = action_service.get_root_liveaction(liveaction_db)
action_service.request_pause(
root_liveaction,
self.context.get('user', None)
)

result = {
"schema": self.schema,
"roles": self.roles_param,
"users": self.users_param,
"route": self.route,
"ttl": self.ttl
}
return (LIVEACTION_STATUS_PENDING, result, None)
37 changes: 37 additions & 0 deletions contrib/runners/inquirer/runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- description: A runner for Inquiries
enabled: true
name: inquirer
runner_module: inquirer
runner_parameters:
schema:
default:
title: response_data
type: object
properties:
continue:
type: boolean
description: Would you like to continue the workflow?
required: True
required: true
description: A JSON schema that will be used to validate the response data
type: object
route:
default: ""
required: false
description: An arbitrary value for allowing rules to route to proper notification channel
type: string
roles:
default: []
required: false
description: A list of roles that are permitted to respond to the action (if nothing provided, all are permitted) - REQUIRES ENTERPRISE FEATURES
type: array
users:
default: []
required: false
description: A list of usernames that are permitted to respond to the action (if nothing provided, all are permitted)
type: array
ttl:
default: 1440
required: true
description: Time (in minutes) to wait before timing out the inquiry if no response is received
type: integer
Empty file.
Empty file.
Empty file.
Loading