From c62e8344465e4dea2e7cb06ae8bc535f8e0ab7ce Mon Sep 17 00:00:00 2001 From: Tanmoy Sarkar <57363826+tanmoysrt@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:26:35 +0530 Subject: [PATCH] fix: while fetching cluster, versions for site plan consider only active bench --- press/api/site.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/press/api/site.py b/press/api/site.py index 90ea1fad62..ba4641cef9 100644 --- a/press/api/site.py +++ b/press/api/site.py @@ -751,6 +751,7 @@ def get_site_plans(): .on(Bench.group == plan_details_query.release_group) .left_join(ReleaseGroup) .on(ReleaseGroup.name == plan_details_query.release_group) + .where(Bench.status == "Active") ) plan_details = plan_details_with_bench_query.run(as_dict=True) @@ -786,9 +787,14 @@ def get_site_plans(): and plan_details_dict[plan.name]["release_groups"] ): continue - plan.clusters = plan_details_dict[plan.name]["clusters"] - plan.allowed_apps = plan_details_dict[plan.name]["allowed_apps"] - plan.bench_versions = plan_details_dict[plan.name]["bench_versions"] + if plan.name in plan_details_dict: + plan.clusters = plan_details_dict[plan.name]["clusters"] + plan.allowed_apps = plan_details_dict[plan.name]["allowed_apps"] + plan.bench_versions = plan_details_dict[plan.name]["bench_versions"] + else: + plan.clusters = [] + plan.allowed_apps = [] + plan.bench_versions = [] filtered_plans.append(plan) return filtered_plans