From ab4d4a5807a9449b6a701e90c198d2cf4328bda6 Mon Sep 17 00:00:00 2001 From: Eyal Date: Thu, 10 Oct 2019 14:44:33 +0300 Subject: [PATCH] Fix the global publish for task If there is a root execution then lazy load the params field of the root execution Change-Id: I6b188e315007391c738b8f821fad91c4fd8572ae --- mistral/api/controllers/v2/task.py | 5 +++++ mistral/tests/unit/api/v2/test_tasks.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/mistral/api/controllers/v2/task.py b/mistral/api/controllers/v2/task.py index 6bdb338d3..2e75672a4 100644 --- a/mistral/api/controllers/v2/task.py +++ b/mistral/api/controllers/v2/task.py @@ -67,6 +67,11 @@ def _get_task_execution(id): ['context', 'input', 'params', 'root_execution'] ) + rest_utils.load_deferred_fields( + task_ex.workflow_execution.root_execution, + ['params'] + ) + return _get_task_resource_with_result(task_ex), task_ex diff --git a/mistral/tests/unit/api/v2/test_tasks.py b/mistral/tests/unit/api/v2/test_tasks.py index 496900503..ddfcde89b 100644 --- a/mistral/tests/unit/api/v2/test_tasks.py +++ b/mistral/tests/unit/api/v2/test_tasks.py @@ -144,6 +144,7 @@ RERUN_TASK = { } MOCK_WF_EX = mock.MagicMock(return_value=WF_EX) +TASK_EX.workflow_execution = WF_EX MOCK_TASK = mock.MagicMock(return_value=TASK_EX) MOCK_TASKS = mock.MagicMock(return_value=[TASK_EX]) MOCK_EMPTY = mock.MagicMock(return_value=[]) @@ -153,6 +154,7 @@ MOCK_ERROR_ITEMS_TASK = mock.MagicMock(return_value=ERROR_ITEMS_TASK_EX) TASK_EX_WITH_PROJECT_ID = TASK_EX.get_clone() TASK_EX_WITH_PROJECT_ID.project_id = '' +TASK_EX_WITH_PROJECT_ID.workflow_execution = WF_EX @mock.patch.object(