From dfc3277ffd3b2217cbc45f8635e4008e0f9d1100 Mon Sep 17 00:00:00 2001 From: Renat Akhmerov Date: Mon, 24 Jun 2019 11:06:59 +0300 Subject: [PATCH] Initialize the lazily loaded execution "input" field in API * After the recent change that made all potentially heavy fields of execution objects lazily loaded, some clients using Mistral APIs started crashing because they expect to get "input" field in JSON of execution objects that Mistral API returns. It wasn't present though because we did not initialize it explicitly in the API controller. * Unfortunately, there's no easy way now to cover this change in the API tests just for how they are organized: they mock all DB calls and return all fields already initialized. We may want to refactor these tests moving forward. Change-Id: I683c79fa0a3ab23a16c493ce2314a506dfee9749 --- mistral/api/controllers/v2/execution.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mistral/api/controllers/v2/execution.py b/mistral/api/controllers/v2/execution.py index d69b8c0ba..1938826a5 100644 --- a/mistral/api/controllers/v2/execution.py +++ b/mistral/api/controllers/v2/execution.py @@ -64,13 +64,13 @@ def _load_deferred_fields(ex, fields): def _get_workflow_execution_resource_with_output(wf_ex): - _load_deferred_fields(wf_ex, ['params', 'output']) + _load_deferred_fields(wf_ex, ['params', 'input', 'output']) return resources.Execution.from_db_model(wf_ex) def _get_workflow_execution_resource(wf_ex): - _load_deferred_fields(wf_ex, ['params']) + _load_deferred_fields(wf_ex, ['params', 'input']) return resources.Execution.from_db_model(wf_ex) @@ -84,7 +84,7 @@ def _get_workflow_execution(id, must_exist=True): else: wf_ex = db_api.load_workflow_execution(id) - return _load_deferred_fields(wf_ex, ['params', 'output']) + return _load_deferred_fields(wf_ex, ['params', 'input', 'output']) # TODO(rakhmerov): Make sure to make all needed renaming on public API.