+class JujuError(Exception):
+ pass
+
-class JujuAPIError(Exception):
+class JujuAPIError(JujuError):
def __init__(self, result):
self.message = result['error']
self.response = result['response']
super().__init__(self.message)
-class JujuConnectionError(ConnectionError):
+class JujuConnectionError(ConnectionError, JujuError):
pass
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__)
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)