From dde634d8b9d8134685c785c012a594080bf9b05e Mon Sep 17 00:00:00 2001 From: Nikolay Mahotkin Date: Mon, 16 Nov 2015 16:27:06 +0300 Subject: [PATCH] Adding callback url to action context * Callback URL is now provided by std.mistral_http action to easy understand where the result should be sent Closes-Bug: #1500833 Change-Id: I347edc5848bde4262a2d57f1787db5f16e218f0a --- mistral/actions/std_actions.py | 1 + mistral/services/action_manager.py | 3 ++- mistral/tests/unit/engine/test_action_context.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mistral/actions/std_actions.py b/mistral/actions/std_actions.py index ba60655d3..05da1aa8d 100644 --- a/mistral/actions/std_actions.py +++ b/mistral/actions/std_actions.py @@ -243,6 +243,7 @@ class MistralHTTPAction(HTTPAction): 'Mistral-Workflow-Execution-Id': actx.get('workflow_execution_id'), 'Mistral-Task-Id': actx.get('task_id'), 'Mistral-Action-Execution-Id': actx.get('action_execution_id'), + 'Mistral-Callback-URL': actx.get('callback_url'), }) super(MistralHTTPAction, self).__init__( diff --git a/mistral/services/action_manager.py b/mistral/services/action_manager.py index 6e5f26792..09bbe5a3b 100644 --- a/mistral/services/action_manager.py +++ b/mistral/services/action_manager.py @@ -154,7 +154,8 @@ def get_action_context(task_ex, action_ex_id): 'task_id': task_ex.id, 'task_name': task_ex.name, 'task_tags': task_ex.tags, - 'action_execution_id': action_ex_id + 'action_execution_id': action_ex_id, + 'callback_url': '/v2/action_executions/%s' % action_ex_id } } diff --git a/mistral/tests/unit/engine/test_action_context.py b/mistral/tests/unit/engine/test_action_context.py index cce0db459..91c60ff86 100644 --- a/mistral/tests/unit/engine/test_action_context.py +++ b/mistral/tests/unit/engine/test_action_context.py @@ -77,7 +77,8 @@ class ActionContextTest(base.EngineTestCase): 'Mistral-Workflow-Name': wf_ex.workflow_name, 'Mistral-Workflow-Execution-Id': wf_ex.id, 'Mistral-Task-Id': task_ex.id, - 'Mistral-Action-Execution-Id': action_ex.id + 'Mistral-Action-Execution-Id': action_ex.id, + 'Mistral-Callback-URL': '/v2/action_executions/%s' % action_ex.id } requests.request.assert_called_with(