Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sweep:integration] fix: dirac_dms_find_lfns: check if requested path exists and return error if not #7781

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading