Skip to content

Commit

Permalink
Merge pull request DIRACGrid#7766 from fstagni/80_fix_rss
Browse files Browse the repository at this point in the history
[8.0] RSS fix: test edge case of no sites
  • Loading branch information
chrisburr authored Aug 28, 2024
2 parents 62351f9 + 6b996e7 commit e4064eb
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 e4064eb

Please sign in to comment.