Commit 6af893ba authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Use always a tstamp wrapper dir.

parent 65432bec
Loading
Loading
Loading
Loading
Loading
+3 −19
Original line number Original line Diff line number Diff line
@@ -103,9 +103,8 @@ class StorePreprocessor(TaskExecutor):
            [ dirs, files ] = self.systemUtils.scan(self.path)
            [ dirs, files ] = self.systemUtils.scan(self.path)
            timestamp = datetime.datetime.now().strftime("%Y_%m_%d-%H_%M_%S")
            timestamp = datetime.datetime.now().strftime("%Y_%m_%d-%H_%M_%S")


            # Case 1: /home/user/store contains both files and dirs
            # Check if /home/user/store contains files or dirs
            if files and dirs:
            if files or dirs:
                self.logger.debug("The 'store' directory contains both files and dirs")
                destPath = self.path + '/' + timestamp + "-vos_wrapper"
                destPath = self.path + '/' + timestamp + "-vos_wrapper"
                os.mkdir(destPath)
                os.mkdir(destPath)
                for file in files:
                for file in files:
@@ -115,22 +114,7 @@ class StorePreprocessor(TaskExecutor):
                    srcPath = self.path + '/' + dir
                    srcPath = self.path + '/' + dir
                    shutil.move(srcPath, destPath)
                    shutil.move(srcPath, destPath)
                self.md5calc.recursive(destPath)
                self.md5calc.recursive(destPath)
            # Case 2: /home/user/store contains only files
            # /home/user/store is empty (this should be handled by data_rpc_server.py)
            elif files and not dirs:
                self.logger.debug("The 'store' directory contains only files")
                destPath = self.path + '/' + timestamp + "-vos_wrapper"
                os.mkdir(destPath)
                for file in files:
                    srcPath = self.path + '/' + file
                    shutil.move(srcPath, destPath)
                self.md5calc.recursive(destPath)
            # Case 3: /home/user/store contains only dirs
            elif not files and dirs:
                self.logger.debug("The 'store' directory contains only dirs")
                for dir in dirs:
                    destPath = self.path + '/' + dir
                    self.md5calc.recursive(destPath)
            # Case 4: /home/user/store is empty (this should be handled by data_rpc_server.py)
            else:
            else:
                self.logger.error("FATAL: the 'store' directory is empty.")
                self.logger.error("FATAL: the 'store' directory is empty.")
                userInfo = self.systemUtils.userInfo(self.username)
                userInfo = self.systemUtils.userInfo(self.username)