From cec90ddf7064d30776b020c2d291f1acf24d41e0 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 9 Nov 2011 17:50:51 -0500 Subject: [PATCH] CC-2870: Create testing infrastructure for testing upgrades -try multiple times until ip address acquired. --- dev_tools/fabric/fab_setup.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dev_tools/fabric/fab_setup.py b/dev_tools/fabric/fab_setup.py index c1060631e..1f1a013e7 100644 --- a/dev_tools/fabric/fab_setup.py +++ b/dev_tools/fabric/fab_setup.py @@ -98,12 +98,16 @@ def create_fresh_os(os_version, os_arch): print "Please wait while attempting to acquire IP address" time.sleep(30) - - ret = local('VBoxManage --nologo guestproperty get "%s" /VirtualBox/GuestInfo/Net/0/V4/IP'%vm_name, capture=True) - - triple = ret.partition(':') - ip_addr = triple[2].strip(' \r\n') - print "Address found %s"%ip_addr + + try_again = True + while try_again: + ret = local('VBoxManage --nologo guestproperty get "%s" /VirtualBox/GuestInfo/Net/0/V4/IP'%vm_name, capture=True) + triple = ret.partition(':') + ip_addr = triple[2].strip(' \r\n') + print "Address found %s"%ip_addr + + try_again = (len(ip_addr) == 0) + env.hosts.append(ip_addr) env.host_string = ip_addr