Skip to content

Commit

Permalink
backend: unknown resalloc tickets helper cleanup
Browse files Browse the repository at this point in the history
If no tickets are taken (which often happens in the staging
environment), this script encountered corner case issues.
  • Loading branch information
praiskup committed Sep 23, 2024
1 parent 609d369 commit cf0fd3c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions backend/run/copr-backend-unknown-resalloc-tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ticket_id.isdigit()
tickets.add(int(ticket_id))
return tickets

Expand Down Expand Up @@ -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)
Expand All @@ -80,3 +84,7 @@ def print_once(message):
else:
print_once("These tickets are relatively new for closing blindly, double check!")
print(f"resalloc ticket-check {unknown_id}")


if __name__ == "__main__":
_main()

0 comments on commit cf0fd3c

Please sign in to comment.