From fffd852e6eecfa8d5c5d64dd318fc8a414fc14bb Mon Sep 17 00:00:00 2001 From: Carl George Date: Wed, 31 Jul 2024 13:27:42 -0500 Subject: [PATCH] Fix RuntimeError in owner-sync-pagure.j2 This is a small follow up fix related to 01be34a70645eb744751b5341fd3a2339d70433c. Previously the script modified a list while iterating through it, which is always a bad idea, but it didn't throw an error. My last changes switched it to iterating through a list, which surfaced the flaw as a RuntimeError. Using a set comprehension is a cleaner way to generate the set we need to return. Signed-off-by: Carl George --- roles/bodhi2/backend/templates/owner-sync-pagure.j2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/bodhi2/backend/templates/owner-sync-pagure.j2 b/roles/bodhi2/backend/templates/owner-sync-pagure.j2 index 0495b6b928..72f3a38de3 100755 --- a/roles/bodhi2/backend/templates/owner-sync-pagure.j2 +++ b/roles/bodhi2/backend/templates/owner-sync-pagure.j2 @@ -175,11 +175,11 @@ def get_project_name_and_its_active_branches(session, namespace, active_branches print('- Querying pagure distgit for package branches') project_branches = get_project_branches(session, namespace, project_name) try: - active_package_branches = active_branches & project_branches - for branch in active_package_branches: - if branch in lookaside: - if project_name in lookaside[branch]: - active_package_branches.remove(branch) + active_package_branches = { + branch + for branch in active_branches & project_branches + if not (branch in lookaside and project_name in lookaside[branch]) + } return project_name, active_package_branches