Skip to content

Commit

Permalink
fix: exit with status 1 in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Jan 21, 2025
1 parent da3f7a4 commit 64e188b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/DIRAC/DataManagementSystem/scripts/dirac_dms_user_lfns.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
/formation/user/v/vhamar/0/20: 1 files, 0 sub-directories
16 matched files have been put in formation-user-v-vhamar.lfns
"""

import fnmatch
from datetime import datetime, timedelta

from DIRAC.Core.Base.Script import Script


Expand Down Expand Up @@ -54,11 +58,6 @@ def main():
from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getVOForGroup
from DIRAC.Core.Security.ProxyInfo import getProxyInfo
from DIRAC.Resources.Catalog.FileCatalog import FileCatalog
from datetime import datetime, timedelta
import sys
import os
import time
import fnmatch

fc = FileCatalog()

Expand Down Expand Up @@ -108,8 +107,10 @@ def isOlderThan(cTimeStruct, days):
res = fc.getDirectoryDump(baseDir, timeout=360)
if not res["OK"]:
gLogger.error("Error retrieving directory contents", f"{baseDir} {res['Message']}")
DIRAC.exit(1)
elif baseDir in res["Value"]["Failed"]:
gLogger.error("Error retrieving directory contents", f"{baseDir} {res['Value']['Failed'][baseDir]}")
DIRAC.exit(1)
else:
dirContents = res["Value"]["Successful"][baseDir]
subdirs = dirContents["SubDirs"]
Expand Down

0 comments on commit 64e188b

Please sign in to comment.