X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=n2vc%2Flibjuju.py;h=f32ea091ca970d86abac9bd4439c2a01383aa735;hb=dfb1eb6246dc99037bd3ead83a895e71c0708022;hp=a90386088ffbc573091b52aceb89dceedd107f54;hpb=582b923b8f3f7104411c39ebdba63949d606ecd1;p=osm%2FN2VC.git diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py index a903860..f32ea09 100644 --- a/n2vc/libjuju.py +++ b/n2vc/libjuju.py @@ -95,7 +95,7 @@ class Libjuju: """ controller = None try: - controller = Controller(loop=self.loop) + controller = Controller() await asyncio.wait_for( controller.connect( endpoint=self.vca_connection.data.endpoints, @@ -1223,6 +1223,10 @@ class Libjuju: controller, timeout=total_timeout, ) + except Exception as e: + if not await self.model_exists(model_name, controller=controller): + return + raise e finally: if model: await self.disconnect_model(model) @@ -1254,6 +1258,10 @@ class Libjuju: raise Exception( "Timeout waiting for model {} to be destroyed".format(model_name) ) + except juju.errors.JujuError as e: + if any("has been removed" in error for error in e.errors): + return + raise e async def destroy_application( self, model_name: str, application_name: str, total_timeout: float