Skip to content

Commit 07037d0

Browse files
authored
Merge pull request #7365 from chaen/v8.0_FIX-accountingJson
fix (WLCG Json accounting): make sure the file we download is json
2 parents e9d5937 + 56732f2 commit 07037d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/DIRAC/Resources/Storage/OccupancyPlugins/WLCGAccountingJson.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def _downloadJsonFile(self, occupancyLFN, filePath):
4444
continue
4545
occupancyURL = res["Value"]
4646
ctx.filecopy(params, occupancyURL, "file://" + filePath)
47+
# Just make sure the file is json, and not SSO HTML
48+
with open(filePath) as f:
49+
json.load(f)
50+
4751
return
4852
except gfal2.GError as e:
4953
detailMsg = "Failed to copy file %s to destination url %s: [%d] %s" % (
@@ -54,6 +58,9 @@ def _downloadJsonFile(self, occupancyLFN, filePath):
5458
)
5559
self.log.debug("Exception while copying", detailMsg)
5660
continue
61+
except json.decoder.JSONDecodeError as e:
62+
self.log.debug("Downloaded file is not json")
63+
continue
5764

5865
def getOccupancy(self, **kwargs):
5966
"""Returns the space information given by WLCG Accouting Json

0 commit comments

Comments
 (0)