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
diff --git a/stable-reports/lib/sru_cycle_status.py b/stable-reports/lib/sru_cycle_status.py
index 11baa0b..cd98e15 100644
--- a/stable-reports/lib/sru_cycle_status.py
+++ b/stable-reports/lib/sru_cycle_status.py
@@ -50,10 +50,17 @@ class SRUCycleStatus:
50 #50 #
51 # Check that variant is present in the bug. This should not51 # Check that variant is present in the bug. This should not
52 # be possible but some bugs hit this state.52 # be possible but some bugs hit this state.
53 if "variant" in bug and bug["variant"] == "snap-debs":53 try:
54 cycles[cycle][series]["order"][f"{bug['package']} / {bug['target']}"] = id54 if "variant" in bug and bug["variant"] == "snap-debs":
55 else:55 cycles[cycle][series]["order"][f"{bug['package']} / {bug['target']}"] = id
56 cycles[cycle][series]["order"][bug["package"]] = id56 else:
57 cycles[cycle][series]["order"][bug["package"]] = id
58 except KeyError as e:
59 # Found a bug in a transient or broken state with a missing target
60 # This is not critical to populating the cycle list
61 with open("/tmp/stable-report-missing-target-bugs.txt", "w") as bug_file:
62 bug_file.write("bug: {} `{}`\n".format(id, str(e)))
63 continue
5764
58 # --- reasons ---65 # --- reasons ---
5966

Subscribers

People subscribed via source and target branches