Merge branch 'issue/249' of git://github.com/asteven/cdist into preos
This commit is contained in:
		
				commit
				
					
						8d167c4ab7
					
				
			
		
					 1 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -23,6 +23,7 @@
 | 
			
		|||
import io
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import glob
 | 
			
		||||
import subprocess
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -94,8 +95,16 @@ class Remote(object):
 | 
			
		|||
        """Transfer a file or directory to the remote side."""
 | 
			
		||||
        self.log.debug("Remote transfer: %s -> %s", source, destination)
 | 
			
		||||
        self.rmdir(destination)
 | 
			
		||||
        if os.path.isdir(source):
 | 
			
		||||
            self.mkdir(destination)
 | 
			
		||||
            for f in glob.glob1(source, '*'):
 | 
			
		||||
                command = self._copy.split()
 | 
			
		||||
        command.extend(["-r", source, self.target_host + ":" + destination])
 | 
			
		||||
                path = os.path.join(source, f)
 | 
			
		||||
                command.extend([path, '{0}:{1}'.format(self.target_host, destination)])
 | 
			
		||||
                self._run_command(command)
 | 
			
		||||
        else:
 | 
			
		||||
            command = self._copy.split()
 | 
			
		||||
            command.extend([source, '{0}:{1}'.format(self.target_host, destination)])
 | 
			
		||||
            self._run_command(command)
 | 
			
		||||
 | 
			
		||||
    def run_script(self, script, env=None, return_output=False):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue