diff --git a/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py b/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py index 112168c3484..30e794b046a 100644 --- a/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py +++ b/src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py @@ -44,6 +44,10 @@ def _downloadJsonFile(self, occupancyLFN, filePath): continue occupancyURL = res["Value"] ctx.filecopy(params, occupancyURL, "file://" + filePath) + # Just make sure the file is json, and not SSO HTML + with open(filePath) as f: + json.load(f) + return except gfal2.GError as e: detailMsg = "Failed to copy file %s to destination url %s: [%d] %s" % ( @@ -54,6 +58,9 @@ def _downloadJsonFile(self, occupancyLFN, filePath): ) self.log.debug("Exception while copying", detailMsg) continue + except json.decoder.JSONDecodeError as e: + self.log.debug("Downloaded file is not json") + continue def getOccupancy(self, **kwargs): """Returns the space information given by WLCG Accouting Json