Skip to content

Commit

Permalink
sweep: DIRACGrid#7779 fix: dirac_dms_find_lfns: check if requested pa…
Browse files Browse the repository at this point in the history
…th exists and return error if not
  • Loading branch information
marianne013 authored and web-flow committed Sep 11, 2024
1 parent 42eb265 commit 9493447
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/DIRAC/DataManagementSystem/scripts/dirac_dms_find_lfns.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@Script()
def main():
Script.registerSwitch("", "Path=", " Path to search for")
Script.registerSwitch("", "Path=", " Directory path to search for")
Script.registerSwitch("", "SE=", " (comma-separated list of) SEs/SE-groups to be searched")
# Registering arguments will automatically add their description to the help menu
Script.registerArgument(
Expand Down Expand Up @@ -59,7 +59,17 @@ def main():
DIRAC.exit(-1)
metaDict = result["Value"]
path = metaDict.pop("Path", path)

# check if path exists and is a directory
result = fc.isDirectory(path)
if not result["OK"]:
gLogger.error("Can not access File Catalog:", result["Message"])
DIRAC.exit(-1)
if path not in result["Value"]["Successful"]:
gLogger.error("Failed to query path status in file catalogue.", result["Message"])
DIRAC.exit(-1)
if not result["Value"]["Successful"][path]:
gLogger.error(f"{path} does not exist or is not a directory.")
DIRAC.exit(-1)
result = fc.findFilesByMetadata(metaDict, path)
if not result["OK"]:
gLogger.error("Can not access File Catalog:", result["Message"])
Expand Down

0 comments on commit 9493447

Please sign in to comment.