You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/01/10 15:29:39 UTC

[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.

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 <to...@apache.org>
Authored: Fri Jan 10 15:24:57 2014 +0100
Committer: Tomaz Muraus <to...@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)
 


[2/2] git commit: Add a note / warning.

Posted by to...@apache.org.
Add a note / warning.


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

Branch: refs/heads/trunk
Commit: 9b84bd0316b6b7846de8ff2c480700af0e122cf0
Parents: b6d79be
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Jan 10 15:29:22 2014 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Jan 10 15:29:22 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9b84bd03/libcloud/compute/ssh.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py
index ab186f2..b200238 100644
--- a/libcloud/compute/ssh.py
+++ b/libcloud/compute/ssh.py
@@ -284,9 +284,13 @@ class ParamikoSSHClient(BaseSSHClient):
         stdin.close()
 
         # Receive all the output
-        # Note: This is used instead of chan.makefile approach to prevent
+        # Note #1: This is used instead of chan.makefile approach to prevent
         # buffering issues and hanging if the executed command produces a lot
         # of output.
+        #
+        # Note #2: If you are going to remove "ready" checks inside the loop
+        # you are going to have a bad time. Trying to consume from a channel
+        # which is not ready will block for indefinitely.
         exit_status_ready = chan.exit_status_ready()
 
         while not exit_status_ready: