From c0d8fc0d37343264b9ee5df3eb9f38a521850ab4 Mon Sep 17 00:00:00 2001 From: cody burkard <cody@onlab.us> Date: Thu, 25 Sep 2014 13:55:49 -0700 Subject: [PATCH] wait until sshd has started on each host --- examples/sshd.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/sshd.py b/examples/sshd.py index 27166cb9..d7f45a4f 100755 --- a/examples/sshd.py +++ b/examples/sshd.py @@ -59,6 +59,16 @@ def sshd( network, cmd='/usr/sbin/sshd', opts='-D', connectToRootNS( network, switch, ip, routes ) for host in network.hosts: host.cmd( cmd + ' ' + opts + '&' ) + + # wait until each host's sshd has started up + remaining = list( network.hosts ) + while True: + for host in tuple( remaining ): + if 'sshd is running' in host.cmd( 'service ssh status' ): + remaining.remove( host ) + if not remaining: + break + print print "*** Hosts are running sshd at the following addresses:" print -- GitLab