X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fapplication.py;h=dc615fdea86741db0d5f88e9d8a4a57cb30598a1;hb=5fef7503b13f145adc7cd4ee31c2d684e09a6a85;hp=df309b30366a1913d5c050148d3adaf54324606e;hpb=0056d3f87102e50a1c35c05bdfa25124c387440f;p=osm%2FN2VC.git diff --git a/juju/application.py b/juju/application.py index df309b3..dc615fd 100644 --- a/juju/application.py +++ b/juju/application.py @@ -41,14 +41,18 @@ class Application(model.ModelEntity): """Get the application status, as set by the charm's leader. """ - return self.data['status']['current'] + return self.safe_data['status']['current'] @property def status_message(self): """Get the application status message, as set by the charm's leader. """ - return self.data['status']['message'] + return self.safe_data['status']['message'] + + @property + def tag(self): + return 'application-%s' % self.name async def add_relation(self, local_relation, remote_relation): """Add a relation to another application. @@ -84,7 +88,7 @@ class Application(model.ModelEntity): result = await app_facade.AddUnits( application=self.name, - placement=[parse_placement(to)], + placement=parse_placement(to) if to else None, num_units=count, ) @@ -338,3 +342,11 @@ class Application(model.ModelEntity): """ pass + + async def get_metrics(self): + """Get metrics for this application's units. + + :return: Dictionary of unit_name:metrics + + """ + return await self.model.get_metrics(self.tag)