mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Adding support for file copy to marvin's remoteSSHClient
Signed-off-by: Prasanna Santhanam <Prasanna.Santhanam@citrix.com>
This commit is contained in:
parent
724d40df79
commit
d4d0950d71
@ -53,6 +53,15 @@ class remoteSSHClient(object):
|
||||
|
||||
return results
|
||||
|
||||
def scp(self, srcFile, destPath):
|
||||
transport = paramiko.Transport((self.host, int(self.port)))
|
||||
transport.connect(username = self.user, password=self.passwd)
|
||||
sftp = paramiko.SFTPClient.from_transport(transport)
|
||||
try:
|
||||
sftp.put(srcFile, destPath)
|
||||
except IOError, e:
|
||||
raise e
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ssh = remoteSSHClient("192.168.137.2", 22, "root", "password")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user