Fix ParamikoSSHClient.run() so that it works in Python 3.x by decoding incoming bytes into strings using the bytes decode method.
Closes #347 Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8b8b67cf Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8b8b67cf Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8b8b67cf Branch: refs/heads/trunk Commit: 8b8b67cf78b42a861b67b289d9ca9d0f812e7f93 Parents: cbd2ae6 Author: Eddy Reyes <[email protected]> Authored: Thu Aug 14 13:11:28 2014 -0500 Committer: Tomaz Muraus <[email protected]> Committed: Fri Aug 15 16:14:24 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 5 +++++ libcloud/compute/ssh.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/8b8b67cf/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index edc1711..a7943bb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -61,6 +61,11 @@ Compute (GITHUB-346) [Roeland Kuipers] +- Fix ``ParamikoSSHClient.run`` and ``deploy_node`` method to work correctly + under Python 3. + (GITHUB-347) + [Eddy Reyes] + Storage ~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/8b8b67cf/libcloud/compute/ssh.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/ssh.py b/libcloud/compute/ssh.py index af9c43a..1a88e9f 100644 --- a/libcloud/compute/ssh.py +++ b/libcloud/compute/ssh.py @@ -40,6 +40,7 @@ from os.path import join as pjoin from libcloud.utils.logging import ExtraLogFormatter from libcloud.utils.py3 import StringIO +from libcloud.utils.py3 import b __all__ = [ 'BaseSSHClient', @@ -364,7 +365,7 @@ class ParamikoSSHClient(BaseSSHClient): data = chan.recv(CHUNK_SIZE) while data: - stdout.write(data) + stdout.write(b(data).decode('utf-8')) ready = chan.recv_ready() if not ready: @@ -376,7 +377,7 @@ class ParamikoSSHClient(BaseSSHClient): data = chan.recv_stderr(CHUNK_SIZE) while data: - stderr.write(data) + stderr.write(b(data).decode('utf-8')) ready = chan.recv_stderr_ready() if not ready:
