libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [1/2] git commit: Document some choices in the ssh client.
Date Sat, 28 Dec 2013 23:53:00 GMT
Updated Branches:
  refs/heads/trunk 6c1b9de65 -> a053cde54


Document some choices in the ssh client.


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

Branch: refs/heads/trunk
Commit: 6e53bfff2edaee590cb1d70ba333e7a9a82c203a
Parents: 6c1b9de
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Sat Dec 28 23:54:26 2013 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sun Dec 29 00:16:47 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/ssh.py | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6e53bfff/libcloud/compute/ssh.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py
index d476e87..7cbcee6 100644
--- a/libcloud/compute/ssh.py
+++ b/libcloud/compute/ssh.py
@@ -239,20 +239,32 @@ class ParamikoSSHClient(BaseSSHClient):
         return True
 
     def run(self, cmd):
+        """
+        Note: This function is based on paramiko's exec_command()
+        method.
+        """
         extra = {'_cmd': cmd}
         self.logger.debug('Executing command', extra=extra)
 
-        # based on exec_command()
+        # Use the system default buffer size
         bufsize = -1
-        t = self.client.get_transport()
-        chan = t.open_session()
+
+        transport = self.client.get_transport()
+        chan = transport.open_session()
+
         chan.exec_command(cmd)
+
         stdin = chan.makefile('wb', bufsize)
         stdout = chan.makefile('rb', bufsize)
         stderr = chan.makefile_stderr('rb', bufsize)
-        #stdin, stdout, stderr = self.client.exec_command(cmd)
+
         stdin.close()
+
+        # Receive the exit status code of the command we ran.
+        # Note: If the command hasn't finished yet, this method will block
+        # until it does
         status = chan.recv_exit_status()
+
         so = stdout.read()
         se = stderr.read()
 


Mime
View raw message