Commit 99c32f4d authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Senthil Kumaran Shanmugasundaram

Fix crash when action_metadata is None

Change-Id: I8be314e68e9ca47221e9692257c0fbbfae1d73b4
parent e5aca37a
......@@ -317,12 +317,15 @@ class FailedJobTable(JobTable):
if record.failure_comment:
return record.failure_comment
try:
failure = TestCase.objects.get(suite__job=record, suite__name='lava', name='job')
failure = TestCase.objects.get(suite__job=record, result=TestCase.RESULT_FAIL,
suite__name='lava', name='job')
except TestCase.DoesNotExist:
return ''
if failure.result == TestCase.RESULT_FAIL:
action_metadata = failure.action_metadata
if action_metadata is not None and 'error_msg' in action_metadata:
return yaml.dump(failure.action_metadata['error_msg'])
return None
else:
return ''
class Meta(JobTable.Meta): # pylint: disable=too-few-public-methods,no-init,no-self-use
fields = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment