Fix error message format in action handler
Change-Id: I562429934b6f53eb5bc84adba38b7446b9b58c51
This commit is contained in:
parent
88047afc96
commit
f1071f5908
@ -36,8 +36,10 @@ def on_action_complete(action_ex, result):
|
|||||||
try:
|
try:
|
||||||
action.complete(result)
|
action.complete(result)
|
||||||
except exc.MistralException as e:
|
except exc.MistralException as e:
|
||||||
msg = ("Failed to complete action [action=%s, task=%s]: %s\n%s" %
|
msg = (
|
||||||
(action_ex.name, task_ex.name, e, tb.format_exc()))
|
"Failed to complete action [error=%s, action=%s, task=%s]:\n%s"
|
||||||
|
% (e, action_ex.name, task_ex.name, tb.format_exc())
|
||||||
|
)
|
||||||
|
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ from oslo_config import cfg
|
|||||||
|
|
||||||
from mistral.db.v2 import api as db_api
|
from mistral.db.v2 import api as db_api
|
||||||
from mistral import exceptions as exc
|
from mistral import exceptions as exc
|
||||||
|
from mistral.services import workbooks as wb_service
|
||||||
from mistral.services import workflows as wf_service
|
from mistral.services import workflows as wf_service
|
||||||
from mistral.tests.unit.engine import base
|
from mistral.tests.unit.engine import base
|
||||||
from mistral.workflow import states
|
from mistral.workflow import states
|
||||||
@ -538,3 +539,42 @@ class ErrorHandlingEngineTest(base.EngineTestCase):
|
|||||||
self.assertIsNotNone(state_info)
|
self.assertIsNotNone(state_info)
|
||||||
self.assertTrue(state_info.find('error=') > 0)
|
self.assertTrue(state_info.find('error=') > 0)
|
||||||
self.assertTrue(state_info.find('error=') < state_info.find('wf='))
|
self.assertTrue(state_info.find('error=') < state_info.find('wf='))
|
||||||
|
|
||||||
|
def test_error_message_format_on_adhoc_action_error(self):
|
||||||
|
wb_text = """
|
||||||
|
version: '2.0'
|
||||||
|
|
||||||
|
name: wb
|
||||||
|
|
||||||
|
actions:
|
||||||
|
my_action:
|
||||||
|
input:
|
||||||
|
- output
|
||||||
|
output: <% invalid_yaql_function() %>
|
||||||
|
base: std.echo
|
||||||
|
base-input:
|
||||||
|
output: <% $.output %>
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
wf:
|
||||||
|
tasks:
|
||||||
|
task1:
|
||||||
|
action: my_action output="test"
|
||||||
|
"""
|
||||||
|
|
||||||
|
wb_service.create_workbook_v2(wb_text)
|
||||||
|
|
||||||
|
wf_ex = self.engine.start_workflow('wb.wf', {})
|
||||||
|
|
||||||
|
self.await_workflow_error(wf_ex.id)
|
||||||
|
|
||||||
|
with db_api.transaction():
|
||||||
|
wf_ex = db_api.get_workflow_execution(wf_ex.id)
|
||||||
|
|
||||||
|
task_ex = wf_ex.task_executions[0]
|
||||||
|
|
||||||
|
state_info = task_ex.state_info
|
||||||
|
|
||||||
|
self.assertIsNotNone(state_info)
|
||||||
|
self.assertTrue(state_info.find('error=') > 0)
|
||||||
|
self.assertTrue(state_info.find('error=') < state_info.find('action='))
|
||||||
|
Loading…
Reference in New Issue
Block a user