Merge ~fginther/+git/ksc-test-results:fginther/allow-missing-bug-target into ~canonical-kernel/+git/ksc-test-results:main

Proposed by Francis Ginther
Status: Merged
Merged at revision: 38ec47d90692147b648ac2dadd4834aaf6b0aa95
Proposed branch: ~fginther/+git/ksc-test-results:fginther/allow-missing-bug-target
Merge into: ~canonical-kernel/+git/ksc-test-results:main
Diff against target: 25 lines (+11/-4)
1 file modified
stable-reports/lib/sru_cycle_status.py (+11/-4)
Reviewer Review Type Date Requested Status
Cory Todd (community) Approve
Canonical Kernel Pending
Review via email: mp+437898@code.launchpad.net

Commit message

sru_cycle_status: Don't crash on bugs missing a target field

When calculating the active sru_cycles, we sometimes encounter a bug
with a missing `target` field. Log the bug, but don't crash.

Signed-off-by: Francis Ginther <email address hidden>

To post a comment you must log in.
Revision history for this message
Cory Todd (corytodd) wrote :

LGTM. It will be interesting to see if there is any pattern to the offending requests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/stable-reports/lib/sru_cycle_status.py b/stable-reports/lib/sru_cycle_status.py
2index 11baa0b..cd98e15 100644
3--- a/stable-reports/lib/sru_cycle_status.py
4+++ b/stable-reports/lib/sru_cycle_status.py
5@@ -50,10 +50,17 @@ class SRUCycleStatus:
6 #
7 # Check that variant is present in the bug. This should not
8 # be possible but some bugs hit this state.
9- if "variant" in bug and bug["variant"] == "snap-debs":
10- cycles[cycle][series]["order"][f"{bug['package']} / {bug['target']}"] = id
11- else:
12- cycles[cycle][series]["order"][bug["package"]] = id
13+ try:
14+ if "variant" in bug and bug["variant"] == "snap-debs":
15+ cycles[cycle][series]["order"][f"{bug['package']} / {bug['target']}"] = id
16+ else:
17+ cycles[cycle][series]["order"][bug["package"]] = id
18+ except KeyError as e:
19+ # Found a bug in a transient or broken state with a missing target
20+ # This is not critical to populating the cycle list
21+ with open("/tmp/stable-report-missing-target-bugs.txt", "w") as bug_file:
22+ bug_file.write("bug: {} `{}`\n".format(id, str(e)))
23+ continue
24
25 # --- reasons ---
26

Subscribers

People subscribed via source and target branches