Hack around strange change in ssh behaviour.
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Jun 2016 15:05:45 +0000 (16:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 9 Jun 2016 15:05:45 +0000 (16:05 +0100)
Before 16.04 as host OS, we would start a VM and then soon
after ssh to it.  This ssh would block while the VM got started
then proceed normally.

Now we get a "connection closed by remote host", so we have to
ignore this and keep trying until the VM is up.

cdistvm

diff --git a/cdistvm b/cdistvm
index e43ad823a62359f3fe0a29c96485d7a5d67a6745..e9e53a4887b33ca2809e14369c97ebb166ac52d8 100755 (executable)
--- a/cdistvm
+++ b/cdistvm
@@ -68,8 +68,17 @@ ports = { 'fedora-22-32': 2000,
           'arch-64': 2004 }
 
 vbox = subprocess.Popen('vboxheadless --startvm %s' % args.target, shell=True)
-time.sleep(10)
-command('ssh -p %d carl@localhost "rm -rf cdistvm /var/tmp/tmp*"' % ports[args.target])
+
+ok = False
+while ok == False:
+    time.sleep(10)
+    try:
+        command('ssh -p %d carl@localhost "rm -rf cdistvm /var/tmp/tmp*"' % ports[args.target])
+        ok = True
+    except Error as e:
+        print('Ignoring: %s' % e)
+        pass
+
 command('ssh -p %d carl@localhost %s' % (ports[args.target], cdist_cmd))
 if args.command in ['package', 'doxygen', 'manual', 'changelog', 'pot']:
     tmp = tempfile.mkdtemp()