cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanna Santhanam <Prasanna.Santha...@citrix.com>
Subject [PATCH] Adding support for file copy to marvin's remoteSSHClient
Date Tue, 05 Jun 2012 10:38:11 GMT

Signed-off-by: Prasanna Santhanam <Prasanna.Santhanam@citrix.com>
---
 tools/marvin/marvin/remoteSSHClient.py |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index 8836844..4063b33 100644
--- a/tools/marvin/marvin/remoteSSHClient.py
+++ b/tools/marvin/marvin/remoteSSHClient.py
@@ -52,7 +52,16 @@ class remoteSSHClient(object):
                 results.append(strOut.rstrip())
     
         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")
-- 
1.7.9.5


-- 
Prasanna.,

Mime
View raw message