Commit 8d9a36e0 authored by Robert Schmidt's avatar Robert Schmidt

sshconnection class: copy files recursively

parent 42141d9a
...@@ -193,9 +193,9 @@ class SSHConnection(): ...@@ -193,9 +193,9 @@ class SSHConnection():
def copyin(self, ipaddress, username, password, source, destination): def copyin(self, ipaddress, username, password, source, destination):
count = 0 count = 0
copy_status = False copy_status = False
logging.debug('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination) logging.debug('scp -r '+ username + '@' + ipaddress + ':' + source + ' ' + destination)
while count < 10: while count < 10:
scp_spawn = pexpect.spawn('scp '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 100) scp_spawn = pexpect.spawn('scp -r '+ username + '@' + ipaddress + ':' + source + ' ' + destination, timeout = 100)
scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0: if scp_response == 0:
scp_spawn.sendline('yes') scp_spawn.sendline('yes')
...@@ -232,9 +232,9 @@ class SSHConnection(): ...@@ -232,9 +232,9 @@ class SSHConnection():
def copyout(self, ipaddress, username, password, source, destination): def copyout(self, ipaddress, username, password, source, destination):
count = 0 count = 0
copy_status = False copy_status = False
logging.debug('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination) logging.debug('scp -r ' + source + ' ' + username + '@' + ipaddress + ':' + destination)
while count < 4: while count < 4:
scp_spawn = pexpect.spawn('scp ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 100) scp_spawn = pexpect.spawn('scp -r ' + source + ' ' + username + '@' + ipaddress + ':' + destination, timeout = 100)
scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT]) scp_response = scp_spawn.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', pexpect.EOF, pexpect.TIMEOUT])
if scp_response == 0: if scp_response == 0:
scp_spawn.sendline('yes') scp_spawn.sendline('yes')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment