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>
This commit is contained in:
Dan Mick 2013-07-25 19:40:26 -07:00
parent 8b3d7a1b5e
commit fbf74d987d

View File

@ -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)