Merge "Change HTTPUnprocessableEntity to HTTPBadRequest"

This commit is contained in:
Jenkins 2014-04-03 01:50:28 +00:00 committed by Gerrit Code Review
commit 47db19d093
2 changed files with 3 additions and 3 deletions

View File

@ -192,7 +192,7 @@ class ServiceController(object):
msg = _('The string containing the reason for disabling '
'the service contains invalid characters or is '
'too long.')
raise webob.exc.HTTPUnprocessableEntity(detail=msg)
raise webob.exc.HTTPBadRequest(explanation=msg)
status_detail['disabled_reason'] = reason
ret_value['service']['disabled_reason'] = reason
@ -200,7 +200,7 @@ class ServiceController(object):
msg = _('Invalid attribute in the request')
if 'host' in body and 'binary' in body:
msg = _('Missing disabled reason field')
raise webob.exc.HTTPUnprocessableEntity(detail=msg)
raise webob.exc.HTTPBadRequest(explanation=msg)
try:
self.host_api.service_update(context, host, binary, status_detail)

View File

@ -467,7 +467,7 @@ class ServicesTest(test.TestCase):
body = {'host': 'host1',
'binary': 'nova-compute',
}
self.assertRaises(webob.exc.HTTPUnprocessableEntity,
self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.update, req, "disable-log-reason", body)
def test_invalid_reason_field(self):