Allow None for 'params' when starting a workflow execution

Change-Id: Ic28352d9acbe9e3f53a9d33a4ff0a5f99261f53f
Closes-Bug: #1793651
This commit is contained in:
Renat Akhmerov 2018-11-08 20:53:24 +07:00
parent ec3d14112c
commit b413aa087e
3 changed files with 24 additions and 1 deletions

View File

@ -274,7 +274,7 @@ class ExecutionsController(rest.RestController):
result_exec_dict.get('id'),
result_exec_dict.get('input'),
description=result_exec_dict.get('description', ''),
**result_exec_dict.get('params', {})
**result_exec_dict.get('params') or {}
)
return resources.Execution.from_dict(result)

View File

@ -683,6 +683,23 @@ class TestExecutionsController(base.APITest):
**json.loads(exec_dict['params'])
)
@mock.patch.object(rpc_clients.EngineClient, 'start_workflow')
def test_post_with_params_none(self, start_wf_func):
wf_ex_dict = WF_EX.to_dict()
start_wf_func.return_value = wf_ex_dict
json_body = WF_EX_JSON_WITH_DESC.copy()
json_body['params'] = None
expected_json = WF_EX_JSON_WITH_DESC
resp = self.app.post_json('/v2/executions', json_body)
self.assertEqual(201, resp.status_int)
self.assertDictEqual(expected_json, resp.json)
@mock.patch.object(
rpc_clients.EngineClient,
'start_workflow',

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed a backward compatibility issue: there was a change made in Rocky
that disallowed the 'params' property of a workflow execution to be None
when one wants to start a workflow.