Fix broken call to re.search()
[sdnvpn.git] / sdnvpn / lib / utils.py
index d085111..98a1e87 100644 (file)
@@ -54,7 +54,7 @@ def create_subnet(neutron_client, name, cidr, net_id):
 
 def create_network(neutron_client, net, subnet1, cidr1,
                    router, subnet2=None, cidr2=None):
-    """Network assoc will not work for networks/subnets created by this function.
+    """Network assoc won't work for networks/subnets created by this function.
 
     It is an ODL limitation due to it handling routers as vpns.
     See https://bugs.opendaylight.org/show_bug.cgi?id=6962"""
@@ -234,6 +234,11 @@ def get_installer_ip():
     return str(os.environ['INSTALLER_IP'])
 
 
+def get_instance_ip(instance):
+    instance_ip = instance.networks.itervalues().next()[0]
+    return instance_ip
+
+
 def wait_for_instance(instance):
     logger.info("Waiting for instance %s to get a DHCP lease..." % instance.id)
     # The sleep this function replaced waited for 80s
@@ -412,7 +417,7 @@ def wait_for_cloud_init(instance):
             logger.error("Cloud init failed to run. Reason: %s",
                          instance_log)
             break
-        if re.search(r"Cloud-init v. .+ finished at" in instance_log):
+        if re.search(r"Cloud-init v. .+ finished at", instance_log):
             success = True
             break
         time.sleep(sleep_time)