diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-18 14:16:19 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2015-09-18 14:16:19 +0100 |
commit | 7a7dac8351135a4cd6a5039a61cf249b922030d1 (patch) | |
tree | ba97ec4c778c87e91a437899bc71440151e34c70 | |
parent | 17fba3d5a73170314c0785921e357d4408705eb3 (diff) | |
download | ciat-tester-7a7dac8351135a4cd6a5039a61cf249b922030d1.tar.gz |
Try different approach to printing ssh command output.
-rwxr-xr-x | openstack/tester | 15 |
1 files 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. |