From 7a7dac8351135a4cd6a5039a61cf249b922030d1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 18 Sep 2015 14:16:19 +0100 Subject: Try different approach to printing ssh command output. --- openstack/tester | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/openstack/tester b/openstack/tester index 18ab59f..0f3526c 100755 --- a/openstack/tester +++ b/openstack/tester @@ -81,12 +81,15 @@ class DeployedSystemInstance(object): self.connection = None def runcmd(self, cmd): - tran = self.connection.get_transport() - chan = tran.open_session() - chan.get_pty() - f = chan.makefile() - chan.exec_command(cmd) - print f.read() + stdin, stdout, stderr = self.connection.exec_command(cmd) + + while not stdout.channel.exit_status_ready(): + if stdout.channel.recv_ready(): + rl, wl, xl = select.select([stdout.channel], [], [], 0.0) + if len(rl) > 0: + # Print data from stdout + print stdout.channel.recv(1024), + print stderr.read(), def _wait_for_dhcp(self, timeout): '''Block until given hostname resolves successfully. -- cgit v1.2.1