diff --git a/ironic_inspector/process.py b/ironic_inspector/process.py index 325ed820e..83b7ddccd 100644 --- a/ironic_inspector/process.py +++ b/ironic_inspector/process.py @@ -234,7 +234,8 @@ def process(introspection_data): 'error': exc} node_info.finished(error=msg) _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: _store_logs(introspection_data, node_info) diff --git a/ironic_inspector/test/unit/test_process.py b/ironic_inspector/test/unit/test_process.py index 6b90b4393..befc4ed01 100644 --- a/ironic_inspector/test/unit/test_process.py +++ b/ironic_inspector/test/unit/test_process.py @@ -134,9 +134,11 @@ class TestProcess(BaseProcessTest): def test_unexpected_exception(self): self.process_mock.side_effect = RuntimeError('boom') - self.assertRaisesRegexp(utils.Error, 'Unexpected exception', - process.process, self.data) + with self.assertRaisesRegexp(utils.Error, + 'Unexpected exception') as ctx: + process.process(self.data) + self.assertEqual(500, ctx.exception.http_code) self.node_info.finished.assert_called_once_with( error='Unexpected exception RuntimeError during processing: boom') diff --git a/releasenotes/notes/continue-http-500-62f33d425aade9d7.yaml b/releasenotes/notes/continue-http-500-62f33d425aade9d7.yaml new file mode 100644 index 000000000..d5ba268a4 --- /dev/null +++ b/releasenotes/notes/continue-http-500-62f33d425aade9d7.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed "/v1/continue" to return HTTP 500 on unexpected exceptions, not + HTTP 400.