#3235 hub: fix Task.lock for correctly closed tasks
Merged by tkopecek. Opened by tkopecek.
tkopecek/koji issue3220  into  master

Download 3235.patch

Fixes: https://pagure.io/koji/issue/3220

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

Ah yes, this behavior looks correct.

I just have a couple of readability notes.

  • the added comment says "host assigned", but this could be misread. Might be better to say something slightly different, perhaps "host associated" or "taken by host"
  • every if case but the last here is based on a state check. The last is not, and that arguably led to this oversight. It might be better to refactor the checks just a little. E.g.
    else:
        # state is CLOSED or FAILED
        if otherhost is None:
            log_error(f"Error: task {task_id} is non-free but not handled by any host "
                      f"(state {koji.TASK_STATES[state]})")
        return False

Which should be entirely equivalent, but provides a bit of separate between the implicit state branching and the follow up check for host association.

rebased onto edad8d4461c29f98cfcca462114ea2473063b19d

updated

:thumbsup:

breadcrumb: code last changed in #3007

Commit 78d7f3f3 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata Update from @jobrauer:
- Pull-request tagged with: testing-done

Metadata