Detect errors in bundle deploy
[osm/N2VC.git] / juju / model.py
index 7622178..ecd764b 100644 (file)
@@ -18,7 +18,7 @@ from .constraints import parse as parse_constraints, normalize_key
 from .delta import get_entity_delta
 from .delta import get_entity_class
 from .exceptions import DeadEntityException
-from .errors import JujuAPIError
+from .errors import JujuError, JujuAPIError
 
 log = logging.getLogger(__name__)
 
@@ -1332,6 +1332,9 @@ class BundleHandler(object):
         self.bundle = yaml.safe_load(bundle_yaml)
         self.plan = await self.client_facade.GetBundleChanges(bundle_yaml)
 
+        if self.plan.errors:
+            raise JujuError('\n'.join(self.plan.errors))
+
     async def execute_plan(self):
         for step in self.plan.changes:
             method = getattr(self, step.method)