From 87200e179601ee09db3f1219ac0df6b4c4868753 Mon Sep 17 00:00:00 2001 From: cychiang Date: Fri, 25 Oct 2019 16:20:13 +0800 Subject: [PATCH] mgr: restful requests api adds support multiple commands Add the request api to support parallel as well as sequential execution of commands. Signed-off-by: Duncan Chiang --- src/pybind/mgr/restful/api/request.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pybind/mgr/restful/api/request.py b/src/pybind/mgr/restful/api/request.py index 3c802a429b588..67143ef508dd5 100644 --- a/src/pybind/mgr/restful/api/request.py +++ b/src/pybind/mgr/restful/api/request.py @@ -77,6 +77,14 @@ class Request(RestController): """ Pass through method to create any request """ + if isinstance(request.json, list): + if all(isinstance(element, list) for element in request.json): + return context.instance.submit_request(request.json, **kwargs) + + # The request.json has wrong format + response.status = 500 + return {'message': 'The request format should be [[{c1},{c2}]]'} + return context.instance.submit_request([[request.json]], **kwargs) -- 2.39.5