- bundle = kdu_model
- if kdu_model.startswith("cs:"):
- bundle = kdu_model
- elif kdu_model.startswith("http"):
- # Download the file
- pass
- else:
- # Local file
-
- # if kdu_model.endswith(".tar.gz") or kdu_model.endswith(".tgz")
- # Uncompress temporarily
- # bundle = <uncompressed file>
- pass
-
- if not bundle:
- # Raise named exception that the bundle could not be found
- raise Exception()
-
- print("[install] deploying {}".format(bundle))
- await model.deploy(bundle)
-
- # Get the application
- if atomic:
- # applications = model.applications
- print("[install] Applications: {}".format(model.applications))
- for name in model.applications:
- print("[install] Waiting for {} to settle".format(name))
- application = model.applications[name]
- try:
- # It's not enough to wait for all units to be active;
- # the application status needs to be active as well.
- print("Waiting for all units to be active...")
- await model.block_until(
- lambda: all(
- unit.agent_status == 'idle'
- and application.status in ['active', 'unknown']
- and unit.workload_status in [
- 'active', 'unknown'
- ] for unit in application.units
- ),
- timeout=timeout
- )
- print("All units active.")
-
- except concurrent.futures._base.TimeoutError:
- print("[install] Timeout exceeded; resetting cluster")
- await self.reset(cluster_uuid)
- return False
-
- # Wait for the application to be active
- if model.is_connected():
- print("[install] Disconnecting model")
- await model.disconnect()