From 9cebeb16b50856be83fbf740c6fe0b85cc84baba Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 22 Aug 2024 14:20:23 +0200 Subject: [PATCH] fix: do not get double entries --- src/DIRAC/Core/LCG/GOCDBClient.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/DIRAC/Core/LCG/GOCDBClient.py b/src/DIRAC/Core/LCG/GOCDBClient.py index 2b735a1709d..8bb9be47698 100644 --- a/src/DIRAC/Core/LCG/GOCDBClient.py +++ b/src/DIRAC/Core/LCG/GOCDBClient.py @@ -356,10 +356,11 @@ def _downTimeXMLParsing(self, dt, siteOrRes, entities=None, startDateMax=None): try: dtDict[str(dtElement.getAttributeNode("PRIMARY_KEY").nodeValue) + " " + elements["ENDPOINT"]] = elements - dtDict[str(dtElement.getAttributeNode("PRIMARY_KEY").nodeValue) + " " + elements["ENDPOINT"]][ - "URL" - ] = urls[0] - except Exception: + if urls: + dtDict[str(dtElement.getAttributeNode("PRIMARY_KEY").nodeValue) + " " + elements["ENDPOINT"]][ + "URL" + ] = urls[0] + except Exception as e: try: dtDict[ str(dtElement.getAttributeNode("PRIMARY_KEY").nodeValue) + " " + elements["HOSTNAME"]