Hi, all
By the comment of ceph-mgr restful plugin's /request post method, it should take ceph commands and fetch result back. However, I am having trouble of writing a curl example. Running Ceph 12.2.2 and havn't found any documentation on posting to this endpoint. Can someone shed some light on it?
Below example produces ValueError in log.
curl --request POST --silent --insecure --user testuser:0244dc6e-0fcb-4b89-bf21-571de094a7a6 https://192.168.52.132:8003/request -d "{'prefix': 'status'}"
ceph-mgr's error message:
2017-12-26 05:08:20.200251 7fd496c20700 0 mgr[restful] Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 570, in __call__
self.handle_request(req, resp)
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 508, in handle_request
result = controller(*args, **kwargs)
File "/usr/lib64/ceph/mgr/restful/decorators.py", line 33, in decorated
return f(*args, **kwargs)
File "/usr/lib64/ceph/mgr/restful/api/request.py", line 87, in post
return module.instance.submit_request([[request.json]], **kwargs)
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 35, in __getattr__
return getattr(obj, attr)
File "/usr/lib/python2.7/site-packages/webob/request.py", line 701, in _json_body__get
return json.loads(self.body.decode(self.charset))
File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 570, in __call__
self.handle_request(req, resp)
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 508, in handle_request
result = controller(*args, **kwargs)
File "/usr/lib64/ceph/mgr/restful/decorators.py", line 33, in decorated
return f(*args, **kwargs)
File "/usr/lib64/ceph/mgr/restful/api/request.py", line 87, in post
return module.instance.submit_request([[request.json]], **kwargs)
File "/usr/lib/python2.7/site-packages/pecan/core.py", line 35, in __getattr__
return getattr(obj, attr)
File "/usr/lib/python2.7/site-packages/webob/request.py", line 701, in _json_body__get
return json.loads(self.body.decode(self.charset))
File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Any help is much appreciated.
Thanks,
Zhenhua
_______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com