From 6dfe9ae7061ad518262f60cd415b5a43bfa1315c Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Mon, 24 Jun 2019 18:21:17 +0200
Subject: [PATCH] cta-fst-gc now logs an error if it cannot list the contents
 of an FST filesystem or if determine the filesystem's sub directories

---
 python/eosfstgcd/ctafstgcd.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/python/eosfstgcd/ctafstgcd.py b/python/eosfstgcd/ctafstgcd.py
index 837827bd23..5c23426a41 100755
--- a/python/eosfstgcd/ctafstgcd.py
+++ b/python/eosfstgcd/ctafstgcd.py
@@ -302,8 +302,21 @@ class Gc:
         self.processfile(subdir, fstfile)
 
   def processfs(self, path):
-    fssubdirs = [os.path.join(path, f) for f in self.disk.listdir(path)
-      if re.match('^[0-9A-Fa-f]{8}$', f) and self.disk.isdir(os.path.join(path, f))]
+    fsfiles = []
+    try:
+      fsfiles = self.disk.listdir(path)
+    except Exception as err:
+      self.log.error("Failed to list contents of filesystem: path={}: {}".format(path, err))
+      return
+
+    fssubdirs = []
+    try:
+      fssubdirs = [os.path.join(path, f) for f in fsfiles
+        if re.match('^[0-9A-Fa-f]{8}$', f) and self.disk.isdir(os.path.join(path, f))]
+    except Exception as err:
+      self.log.error("Failed to determine sub directories of filesystem: path={}: {}".format(path, err))
+      return
+
     for fssubdir in fssubdirs:
       self.processfssubdir(fssubdir)
 
-- 
GitLab