summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2013-07-25 19:40:26 -0700
committerDan Mick <dan.mick@inktank.com>2013-07-25 20:03:22 -0700
commitfbf74d987d22dcca832a8afd358e0d76d4442f4c (patch)
treefa86a014b6b67f038bfe6139206d82f148e87159
parent8b3d7a1b5ef8d6e8ae1a1f6cfb99463afd5e0bb2 (diff)
downloadceph-fbf74d987d22dcca832a8afd358e0d76d4442f4c.tar.gz
ceph_rest_api.py: return error in nonformatted mode
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>
-rwxr-xr-xsrc/pybind/ceph_rest_api.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pybind/ceph_rest_api.py b/src/pybind/ceph_rest_api.py
index 6165d31f9b9..f69f1809d61 100755
--- a/src/pybind/ceph_rest_api.py
+++ b/src/pybind/ceph_rest_api.py
@@ -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)