Before provisioning a native charm, a script is executed to wait until
cloud-init finishes. This will avoid some racing conditions.
Fixes bug 1184
Change-Id: Icc87f90f5941cf7b13bdd7dd01e5544122fb769e
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
9074b05b797b591eeb9b86b54c5a699b30454906)
firewall-cmd --reload
"""
+CLOUD_INIT_WAIT_SCRIPT = """#!/bin/bash
+set -e
+cloud-init status --wait
+"""
+
class AsyncSSHProvisioner:
"""Provision a manually created machine via SSH."""
- 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