From 6abaf820231bd87bd3ce33e6729198a64fd8a8fb Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Wed, 28 Aug 2024 15:31:51 +0200 Subject: [PATCH] sweep: #7766 RSS fix: test edge case of no sites --- src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py b/src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py index e06c7ad66bb..8452806ffaf 100644 --- a/src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py +++ b/src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py @@ -170,9 +170,9 @@ def getUsableSites(self, siteNames=None): siteStatusDictRes = self.getSiteStatuses(siteNames) if not siteStatusDictRes["OK"]: return siteStatusDictRes - siteStatusList = [x[0] for x in siteStatusDictRes["Value"].items() if x[1] in ["Active", "Degraded"]] - - return S_OK(siteStatusList) + if not siteStatusDictRes["Value"]: + return S_OK([]) + return S_OK([x[0] for x in siteStatusDictRes["Value"].items() if x[1] in ["Active", "Degraded"]]) def getSites(self, siteState="Active"): """ @@ -203,6 +203,8 @@ def getSites(self, siteState="Active"): siteStatusDictRes = self.getSiteStatuses() if not siteStatusDictRes["OK"]: return siteStatusDictRes + if not siteStatusDictRes["Value"]: + return S_OK([]) if siteState.capitalize() == "All": # if no siteState is set return everything