Update helm repo after adding the repo
[osm/N2VC.git] / n2vc / provisioner.py
index e2b51b9..ab25993 100644 (file)
@@ -85,6 +85,11 @@ firewall-cmd --direct --permanent --add-rule ipv4 nat OUTPUT 0 -d {} -p tcp \
 firewall-cmd --reload
 """
 
+CLOUD_INIT_WAIT_SCRIPT = """#!/bin/bash
+set -e
+cloud-init status --wait
+"""
+
 
 class AsyncSSHProvisioner:
     """Provision a manually created machine via SSH."""
@@ -299,6 +304,12 @@ class AsyncSSHProvisioner:
             - 127.0.0.1:17070
             - '[::1]:17070'
         """
+        try:
+            # Wait until cloud-init finish
+            await self._run_configure_script(CLOUD_INIT_WAIT_SCRIPT)
+        except Exception:
+            self.log.debug("cloud-init not present in machine {}".format(machine_id))
+
         if proxy:
             m = re.search(
                 r"apiaddresses:\n- (\d+\.\d+\.\d+\.\d+):17070", results.script