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 d25c5de
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 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 c.isdigit()

Check warning

Code scanning / vcs-diff-lint

used_ids: Undefined variable 'c' Warning

used_ids: Undefined variable 'c'

Check warning

Code scanning / vcs-diff-lint

Undefined name c Warning

Undefined name c
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():

Check warning

Code scanning / vcs-diff-lint

_main: Either all return statements in a function should return an expression, or none of them should. Warning

_main: Either all return statements in a function should return an expression, or none of them should.
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,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()

0 comments on commit d25c5de

Please sign in to comment.