build: unbreak JSON serializer on failed builds
Commit 3fa5a236b4
converted status
consts into Enum. But not completely - this fix gets it done properly.
Also fixed tests.
Change-Id: Ifdacf62cd4b99c452bd09de7c6cde6fbee75560d
This commit is contained in:
parent
efaab1f3a5
commit
c4c28814e0
|
@ -1168,10 +1168,10 @@ class KollaWorker(object):
|
|||
LOG.info("Images that failed to build")
|
||||
LOG.info("===========================")
|
||||
for name, status in sorted(self.image_statuses_bad.items()):
|
||||
LOG.error('%s Failed with status: %s', name, status)
|
||||
LOG.error('%s Failed with status: %s', name, status.value)
|
||||
results['failed'].append({
|
||||
'name': name,
|
||||
'status': status,
|
||||
'status': status.value,
|
||||
})
|
||||
if self.conf.logs_dir and status == Status.ERROR:
|
||||
linkname = os.path.join(self.conf.logs_dir,
|
||||
|
|
|
@ -646,11 +646,11 @@ class KollaWorkerTest(base.TestCase):
|
|||
def test_summary(self):
|
||||
kolla = build.KollaWorker(self.conf)
|
||||
kolla.images = self.images
|
||||
kolla.image_statuses_good['good'] = None
|
||||
kolla.image_statuses_bad['bad'] = None
|
||||
kolla.image_statuses_unmatched['unmatched'] = None
|
||||
kolla.image_statuses_good['good'] = build.Status.BUILT
|
||||
kolla.image_statuses_bad['bad'] = build.Status.ERROR
|
||||
kolla.image_statuses_unmatched['unmatched'] = build.Status.UNMATCHED
|
||||
results = kolla.summary()
|
||||
self.assertIsNone(results['failed'][0]['status'])
|
||||
self.assertEqual('error', results['failed'][0]['status'])
|
||||
|
||||
@mock.patch('shutil.copytree')
|
||||
def test_work_dir(self, copytree_mock):
|
||||
|
|
Loading…
Reference in New Issue