X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fapplication.py;h=69f412fb2044a7412dde0d0a5decf90195b8962e;hb=41ba4699c6b3f636fb75eb27322e2dfa81f3313e;hp=4a98622de21707f8066f5972d961be4387108b2e;hpb=bccd5c73a2f02a768612c7aec318c910fceda299;p=osm%2FN2VC.git diff --git a/juju/application.py b/juju/application.py index 4a98622..69f412f 100644 --- a/juju/application.py +++ b/juju/application.py @@ -3,6 +3,7 @@ import logging from . import model from .client import client +from .placement import parse as parse_placement log = logging.getLogger(__name__) @@ -40,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. @@ -83,7 +88,7 @@ class Application(model.ModelEntity): result = await app_facade.AddUnits( application=self.name, - placement=to, + placement=[parse_placement(to)] if to else None, num_units=count, ) @@ -337,3 +342,6 @@ class Application(model.ModelEntity): """ pass + + async def get_metrics(self): + return await self.model.get_metrics(self.tag)