Commit cba8f181 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added support for parent dirs preservation.

parent fa127f8a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ class DbConnector(object):
                fullPath = basePath + "/" + userName + osPath
            else:
                fullPath = basePath + "/" + userName + "/" + tstampWrappedDir + osPath
            return [ fullPath, storageType, userName ]
            return [ fullPath, storageType, userName, osPath ]

    def getVOSpacePathList(self, vospacePath):
        """Returns the list of VOSpace paths carried by a VOSpace node, according to the node VOSpace path."""
+7 −3
Original line number Diff line number Diff line
import os
import subprocess
import sys

@@ -30,14 +31,17 @@ class RetrieveExecutor(TaskExecutor):
        self.dbConn.connect()
        self.dbConn.setPhase(self.jobId, "EXECUTING")
        for vospacePath in self.nodeList:
            [srcPath, storageType, username] = self.dbConn.getOSPath(vospacePath)
            destPath = self.storageRetrievePath.replace("{username}", username)
            [srcPath, storageType, username, osRelPath] = self.dbConn.getOSPath(vospacePath)
            osRelParentPath = os.path.dirname(osRelPath)
            if osRelParentPath != "/":
                osRelParentPath += "/"
            destPath = self.storageRetrievePath.replace("{username}", username) + osRelParentPath
            if storageType == "cold":
                #srcPathPrefix = self.tapeStorageBasePath.replace("{username}", self.username)
                # TO BE DONE 
                pass
            else:
                sp = subprocess.run(["rsync", "-av", srcPath, destPath + "/"], capture_output = True)
                sp = subprocess.run(["rsync", "-av", srcPath, destPath], capture_output = True)
                if(sp.returncode or sp.stderr):
                    self.dbConn.disconnect()
                    return False