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: Fix a regression in the paramiko SSH client which would make it not return all the output for all the commands which exited quickly.
Date Fri, 10 Jan 2014 14:29:39 GMT
Updated Branches:
  refs/heads/trunk b6ada523b -> 9b84bd031


Fix a regression in the paramiko SSH client which would make it not return all
the output for all the commands which exited quickly.

Part of LIBCLOUD-491.


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

Branch: refs/heads/trunk
Commit: b6d79be92597071d31cd581aca0ac71564658fcb
Parents: b6ada52
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Fri Jan 10 15:24:57 2014 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Fri Jan 10 15:26:02 2014 +0100

----------------------------------------------------------------------
 libcloud/compute/ssh.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6d79be9/libcloud/compute/ssh.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py
index 5cc877c..ab186f2 100644
--- a/libcloud/compute/ssh.py
+++ b/libcloud/compute/ssh.py
@@ -287,7 +287,9 @@ class ParamikoSSHClient(BaseSSHClient):
         # Note: This is used instead of chan.makefile approach to prevent
         # buffering issues and hanging if the executed command produces a lot
         # of output.
-        while not chan.exit_status_ready():
+        exit_status_ready = chan.exit_status_ready()
+
+        while not exit_status_ready:
             if chan.recv_ready():
                 data = chan.recv(CHUNK_SIZE)
 
@@ -312,6 +314,13 @@ class ParamikoSSHClient(BaseSSHClient):
 
                     data = chan.recv_stderr(CHUNK_SIZE)
 
+            # We need to check the exist status here, because the command could
+            # print some output and exit during this sleep bellow.
+            exit_status_ready = chan.exit_status_ready()
+
+            if exit_status_ready:
+                break
+
             # Short sleep to prevent busy waiting
             time.sleep(1.5)
 


Mime
View raw message