From d25c5de179c32c7b805bc342fed04af9a21168d1 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 23 Sep 2024 15:20:09 +0200 Subject: [PATCH] backend: unknown resalloc tickets helper cleanup If no tickets are taken (which often happens in the staging environment), this script encountered corner case issues. --- .../run/copr-backend-unknown-resalloc-tickets.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/run/copr-backend-unknown-resalloc-tickets.py b/backend/run/copr-backend-unknown-resalloc-tickets.py index b7d8df60d..6acc55787 100755 --- a/backend/run/copr-backend-unknown-resalloc-tickets.py +++ b/backend/run/copr-backend-unknown-resalloc-tickets.py @@ -33,7 +33,9 @@ def used_ids(): output = output.strip() tickets = set() for ticket_id in output.split("\n"): - assert all(c.isdigit() for c in ticket_id) + if len(ticket_id) <= 0: + continue + assert c.isdigit() tickets.add(int(ticket_id)) return tickets @@ -61,11 +63,13 @@ def print_once(message): print(message) storage[message] = True - -if __name__ == "__main__": +def _main(): script_requires_user("resalloc") used = used_ids() + if not used: + print("no tickets used") + return # This is the oldest ticket that Copr Backend currently uses. min_used = min(used) @@ -80,3 +84,9 @@ def print_once(message): else: print_once("These tickets are relatively new for closing blindly, double check!") print(f"resalloc ticket-check {unknown_id}") + + return 0 + + +if __name__ == "__main__": + _main()