X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Funit.py;h=8511a47775edec3e97b218e02211a4ab579ce618;hb=a9de6f59dcc159e4588335f8ef3cb085674faaa5;hp=55a60fd0d9a1638305cef13f715f44968e547a71;hpb=b3ac09e36410618457c3412b43dbe3f271483d15;p=osm%2FN2VC.git diff --git a/juju/unit.py b/juju/unit.py index 55a60fd..8511a47 100644 --- a/juju/unit.py +++ b/juju/unit.py @@ -161,9 +161,9 @@ class Unit(model.ModelEntity): raise Exception('Unknown action error: %s' % error.serialize()) action_id = action.tag[len('action-'):] log.debug('Action started as %s', action_id) - # we can't use wait_for_new here because we don't - # consistently (ever?) get an "add" delta for the action - return await self.model._wait('action', action_id, None) + # we mustn't use wait_for_action because that blocks until the + # action is complete, rather than just being in the model + return await self.model._wait_for_new('action', action_id) def scp( self, source_path, user=None, destination_path=None, proxy=False, @@ -238,3 +238,7 @@ class Unit(model.ModelEntity): # that case, we simply return False, as a destroyed unit # is not a leader. return False + + async def get_metrics(self): + metrics = await self.model.get_metrics(self.tag) + return metrics[self.name]