X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fapplication.py;h=978500fa321ec445a9c686f7da4a3e9630d31277;hb=2ed7314a9ea1240883655bc521b6e27f149aa485;hp=a72533d43daba7fca764015fe05192e4e777d80c;hpb=fe2d2f1a5ef2453359858481929a2526ea1a3c5c;p=osm%2FN2VC.git diff --git a/juju/application.py b/juju/application.py index a72533d..978500f 100644 --- a/juju/application.py +++ b/juju/application.py @@ -1,7 +1,19 @@ +import logging + from . import model +from .client import client + +log = logging.getLogger(__name__) class Application(model.ModelEntity): + @property + def units(self): + return [ + unit for unit in self.model.units.values() + if unit.application == self.name + ] + def add_relation(self, local_relation, remote_relation): """Add a relation to another service. @@ -62,11 +74,17 @@ class Application(model.ModelEntity): pass remove_relation = destroy_relation - def destroy(self): + async def destroy(self): """Remove this service from the model. """ - pass + app_facade = client.ApplicationFacade() + app_facade.connect(self.connection) + + log.debug( + 'Destroying %s', self.name) + + return await app_facade.Destroy(self.name) remove = destroy def expose(self):