cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: Summary: Close the ssh transport from paramiko
Date Tue, 23 Oct 2012 14:24:20 GMT
Updated Branches:
  refs/heads/master d01bbb941 -> 6f2792eb4


Summary: Close the ssh transport from paramiko

Detail: SSH Transport to be explicitly closed in marvin.remoteSSHClient
Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1351002168 +0530


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6f2792eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6f2792eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6f2792eb

Branch: refs/heads/master
Commit: 6f2792eb4b556cc174fecac8dbfcebf5471fbb85
Parents: d01bbb9
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Tue Oct 23 19:52:48 2012 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Tue Oct 23 19:52:48 2012 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/remoteSSHClient.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6f2792eb/tools/marvin/marvin/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index 60df2a7..036e1c3 100644
--- a/tools/marvin/marvin/remoteSSHClient.py
+++ b/tools/marvin/marvin/remoteSSHClient.py
@@ -18,6 +18,8 @@
 import paramiko 
 import time
 import cloudstackException
+import contextlib
+from contextlib import closing
 
 class remoteSSHClient(object):
     def __init__(self, host, port, user, passwd, retries = 10):
@@ -67,8 +69,11 @@ class remoteSSHClient(object):
         except IOError, e:
             raise e
 
+    def close(self):
+        self.ssh.close()
+
             
 if __name__ == "__main__":
-    ssh = remoteSSHClient("192.168.137.2", 22, "root", "password")
-    print ssh.execute("ls -l")
-    print ssh.execute("rm x")
+    with contextlib.closing(remoteSSHClient("10.223.75.10", 22, "root",
+                                            "password")) as ssh:
+        print ssh.execute("ls -l")


Mime
View raw message