From: cychiang Date: Fri, 25 Oct 2019 08:20:13 +0000 (+0800) Subject: mgr: restful requests api adds support multiple commands X-Git-Tag: v15.1.0~1072^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=87200e179601ee09db3f1219ac0df6b4c4868753;p=ceph-ci.git 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 --- diff --git a/src/pybind/mgr/restful/api/request.py b/src/pybind/mgr/restful/api/request.py index 3c802a429b5..67143ef508d 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)