Ejemplo n.º 1
0
def transfer(login, machine):
    """
        @summary : Transfers all the required files
                   from specified machine into local 
                   machine.
    
                   Every task is done 10 times.
        
                   This is done in hope that everything 
                   downloaded will be as coherent as possible.
        
                   If a large amount of file is to 
                   be transferred, some files that were downloaded
                   at the beginning of the transfer,wich can take 
                   up to a few hours,might not be as up to date as 
                   the file downloaded towards the end of the transfer  
   
           
    """

    statsPaths = StatsPaths()
    statsPaths.setPaths()

    localPaths = getLocalPathsToSynchronise()
    buildLocalPaths(localPaths)
    configFiles = getConfigFiles()

    for i in range(10):

        transferLogFiles()

        for localPath in localPaths:
            remotePath = statsPaths.getStatsPathFromMachine(
                localPath, machine, login)
            print "rsync -avzr  --delete-before -e ssh %s@%s:%s %s" % (
                login, machine, remotePath, localPath)
            output = commands.getoutput(
                "rsync -avzr  --delete-before -e ssh %s@%s:%s %s" %
                (login, machine, remotePath, localPath))
            print output

    for configfile in configFiles:
        #get real path
        localPath = os.path.dirname(configfile)
        fileName = os.path.basename(configfile)
        remotePath = statsPaths.getStatsPathFromMachine(
            localPath, machine, login)

        print "rsync -avzr  --delete-before -e ssh %s@%s:%s %s" % (
            login, machine, remotePath + fileName, localPath + fileName)
        output = commands.getoutput(
            "rsync -avzr  --delete-before -e ssh %s@%s:%s %s" %
            (login, machine, remotePath + fileName, localPath + fileName))
        print output
Ejemplo n.º 2
0
def transfer( login, machine ):
    """
        @summary : Transfers all the required files
                   from specified machine into local 
                   machine.
    
                   Every task is done 10 times.
        
                   This is done in hope that everything 
                   downloaded will be as coherent as possible.
        
                   If a large amount of file is to 
                   be transferred, some files that were downloaded
                   at the beginning of the transfer,wich can take 
                   up to a few hours,might not be as up to date as 
                   the file downloaded towards the end of the transfer  
   
           
    """    
    
    statsPaths = StatsPaths()
    statsPaths.setPaths()
    
    localPaths = getLocalPathsToSynchronise()
    buildLocalPaths( localPaths )
    configFiles = getConfigFiles()
            
    for i in range( 10 ):
                
        transferLogFiles()
        
        for localPath in localPaths :
            remotePath = statsPaths.getStatsPathFromMachine( localPath, machine, login )
            print "rsync -avzr  --delete-before -e ssh %s@%s:%s %s"  %( login, machine, remotePath, localPath )
            output = commands.getoutput( "rsync -avzr  --delete-before -e ssh %s@%s:%s %s"  %( login, machine, remotePath, localPath ) )
            print output        
             
            
    for configfile in configFiles:
        #get real path 
        localPath = os.path.dirname( configfile )
        fileName  = os.path.basename( configfile )
        remotePath = statsPaths.getStatsPathFromMachine( localPath, machine, login )
        
        print "rsync -avzr  --delete-before -e ssh %s@%s:%s %s"  %( login, machine, remotePath + fileName, localPath + fileName )
        output = commands.getoutput( "rsync -avzr  --delete-before -e ssh %s@%s:%s %s"  %( login, machine, remotePath + fileName, localPath + fileName ) )
        print output