Merge "Enhance error messages when building containers"
This commit is contained in:
commit
c5b0b44d68
@ -205,12 +205,23 @@ class BuildahBuilder(base.BaseBuilder):
|
|||||||
# failed a SystemError will be raised using the
|
# failed a SystemError will be raised using the
|
||||||
# exception information. If any job was loaded
|
# exception information. If any job was loaded
|
||||||
# but not executed a SystemError will be raised.
|
# but not executed a SystemError will be raised.
|
||||||
|
exceptions = list()
|
||||||
for job in done:
|
for job in done:
|
||||||
if job._exception:
|
if job._exception:
|
||||||
raise SystemError("%(container)s raised %(exception)s" %
|
exceptions.append(
|
||||||
{'container': future_to_build[job],
|
"\nException information: {exception}".format(
|
||||||
'exception': job._exception})
|
exception=job._exception
|
||||||
|
)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
|
if exceptions:
|
||||||
|
raise RuntimeError(
|
||||||
|
'\nThe following errors were detected during '
|
||||||
|
'container build(s):\n{exceptions}'.format(
|
||||||
|
exceptions='\n'.join(exceptions)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not_done:
|
if not_done:
|
||||||
error_msg = ('The following jobs were '
|
error_msg = ('The following jobs were '
|
||||||
'incomplete: {}'.format(
|
'incomplete: {}'.format(
|
||||||
|
@ -185,7 +185,7 @@ class TestBuildahBuilder(base.TestCase):
|
|||||||
mock_submit.side_effect = R_FAILED_LIST
|
mock_submit.side_effect = R_FAILED_LIST
|
||||||
_b = bb(WORK_DIR, DEPS)
|
_b = bb(WORK_DIR, DEPS)
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
SystemError,
|
RuntimeError,
|
||||||
_b.build_all,
|
_b.build_all,
|
||||||
deps=BUILD_ALL_LIST_CONTAINERS
|
deps=BUILD_ALL_LIST_CONTAINERS
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user