Skip to content

Commit

Permalink
fix: test edge case of no sites
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Aug 28, 2024
1 parent 62351f9 commit 6b996e7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/DIRAC/ResourceStatusSystem/Client/SiteStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6b996e7

Please sign in to comment.