Make taskflow_executor log get_flow() exceptions
Currently an exception raised in a get_flow() task builder will be silently swallowed with no logging. This patch makes us log it and then re-raise it so that it will be visible. Change-Id: I4315bfd68e5a184305f384705e35c4049f75b906
This commit is contained in:
parent
c5c7a2a634
commit
a854fcfab8
|
@ -139,6 +139,9 @@ class TaskExecutor(glance.async_.TaskExecutor):
|
|||
raise exception.ImportTaskError(message=exc.msg)
|
||||
except RuntimeError:
|
||||
raise NotImplementedError()
|
||||
except Exception as e:
|
||||
LOG.exception(_LE('Task initialization failed: %s'), str(e))
|
||||
raise
|
||||
|
||||
def begin_processing(self, task_id):
|
||||
try:
|
||||
|
|
|
@ -143,3 +143,15 @@ class TestTaskExecutor(test_utils.BaseTestCase):
|
|||
'backend': None,
|
||||
'admin_repo': admin_repo,
|
||||
'uri': 'http://cloud.foo/image.qcow2'})
|
||||
|
||||
@mock.patch('stevedore.driver.DriverManager')
|
||||
@mock.patch.object(taskflow_executor, 'LOG')
|
||||
def test_get_flow_fails(self, mock_log, mock_driver):
|
||||
mock_driver.side_effect = IndexError('fail')
|
||||
executor = taskflow_executor.TaskExecutor(self.context,
|
||||
self.task_repo,
|
||||
self.image_repo,
|
||||
self.image_factory)
|
||||
self.assertRaises(IndexError, executor._get_flow, self.task)
|
||||
mock_log.exception.assert_called_once_with(
|
||||
'Task initialization failed: %s', 'fail')
|
||||
|
|
Loading…
Reference in New Issue