Return HTTP 500 from /v1/continue on unexpected exceptions
Currently it returns HTTP 400 which is obviously wrong. Closes-Bug: #1590302 Change-Id: I56114aa1c0a3248cc80f79d1a5da3ace6c615e52
This commit is contained in:
parent
457c1277de
commit
223ff38dcf
@ -234,7 +234,8 @@ def process(introspection_data):
|
|||||||
'error': exc}
|
'error': exc}
|
||||||
node_info.finished(error=msg)
|
node_info.finished(error=msg)
|
||||||
_store_logs(introspection_data, node_info)
|
_store_logs(introspection_data, node_info)
|
||||||
raise utils.Error(msg, node_info=node_info, data=introspection_data)
|
raise utils.Error(msg, node_info=node_info, data=introspection_data,
|
||||||
|
code=500)
|
||||||
|
|
||||||
if CONF.processing.always_store_ramdisk_logs:
|
if CONF.processing.always_store_ramdisk_logs:
|
||||||
_store_logs(introspection_data, node_info)
|
_store_logs(introspection_data, node_info)
|
||||||
|
@ -134,9 +134,11 @@ class TestProcess(BaseProcessTest):
|
|||||||
def test_unexpected_exception(self):
|
def test_unexpected_exception(self):
|
||||||
self.process_mock.side_effect = RuntimeError('boom')
|
self.process_mock.side_effect = RuntimeError('boom')
|
||||||
|
|
||||||
self.assertRaisesRegexp(utils.Error, 'Unexpected exception',
|
with self.assertRaisesRegexp(utils.Error,
|
||||||
process.process, self.data)
|
'Unexpected exception') as ctx:
|
||||||
|
process.process(self.data)
|
||||||
|
|
||||||
|
self.assertEqual(500, ctx.exception.http_code)
|
||||||
self.node_info.finished.assert_called_once_with(
|
self.node_info.finished.assert_called_once_with(
|
||||||
error='Unexpected exception RuntimeError during processing: boom')
|
error='Unexpected exception RuntimeError during processing: boom')
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Fixed "/v1/continue" to return HTTP 500 on unexpected exceptions, not
|
||||||
|
HTTP 400.
|
Loading…
Reference in New Issue
Block a user