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__)
await method(delta, old, new, model)
async def on_change(self, delta, old, new, model):
+ """Generic model-change handler.
+
+ :param delta: :class:`juju.client.overrides.Delta`
+ :param old: :class:`juju.model.ModelEntity`
+ :param new: :class:`juju.model.ModelEntity`
+ :param model: :class:`juju.model.Model`
+
+ """
pass
:param str \*tags: Tags of entities from which to retrieve metrics.
No tags retrieves the metrics of all units in the model.
+ :return: Dictionary of unit_name:metrics
+
"""
log.debug("Retrieving metrics for %s",
', '.join(tags) if tags else "all units")
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)