Commit f62625ae authored by Rémi Duraffort's avatar Rémi Duraffort

Fix a crash in job_log_incremental when a result line is too long

When a job log line is too long, the content is stripped and replaced by:
{"dt": "...", "lvl": "results", "msg": {"skip": "line way too long ..."}}.

Fix a crash when such log line is parsed.

See https://sentry.io/organizations/linaro/issues/1958935251Signed-off-by: Rémi Duraffort's avatarRémi Duraffort <remi.duraffort@linaro.org>
parent a425da2c
Pipeline #9320 passed with stages
in 14 minutes and 10 seconds
......@@ -2028,13 +2028,14 @@ def job_log_incremental(request, pk):
for line in data:
line["msg"] = udecode(line["msg"])
if line["lvl"] == "results":
case_id = TestCase.objects.filter(
suite__job=job,
suite__name=line["msg"]["definition"],
name=line["msg"]["case"],
).values_list("id", flat=True)
if case_id:
line["msg"]["case_id"] = case_id[0]
definition = line["msg"].get("definition")
case = line["msg"].get("case")
if definition and case:
case_id = TestCase.objects.filter(
suite__job=job, suite__name=definition, name=case
).values_list("id", flat=True)
if case_id:
line["msg"]["case_id"] = case_id[0]
except (OSError, StopIteration, yaml.YAMLError):
data = []
......
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