]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_rest_api.py: return error in nonformatted mode
authorDan Mick <dan.mick@inktank.com>
Fri, 26 Jul 2013 02:40:26 +0000 (19:40 -0700)
committerDan Mick <dan.mick@inktank.com>
Fri, 26 Jul 2013 03:03:22 +0000 (20:03 -0700)
When a nonformatted request is made, currently the only text in the
response is the (probably empty) response buffer.  Add the statusmsg
as well, where the error is likely to be explained.  This lets
the http client get a clue what happened.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
src/pybind/ceph_rest_api.py

index 6165d31f9b9b8b0c5b814d2ac3a35be968aa244e..f69f1809d61535a44edf49025460d02931db5188 100755 (executable)
@@ -322,6 +322,9 @@ def make_response(fmt, output, statusmsg, errorcode):
     {1}
   </status>
 </response>'''.format(response, xml.sax.saxutils.escape(statusmsg))
+    else:
+        if 200 <= errorcode < 300:
+            response = response + '\n' + statusmsg + '\n'
 
     return flask.make_response(response, errorcode)