X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=n2vc%2Flibjuju.py;h=a5b4d7e082cd4ef54cb81c1d5c08d2c16eace9d1;hb=78e6711f25dae927f129022b6c095d36133f3f24;hp=f57070238d7f6cbc073b08a4320485b4ef6b4bcc;hpb=05bccf7db9202bf50f7c9c7513c36082e73005e1;p=osm%2FN2VC.git diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py index f570702..a5b4d7e 100644 --- a/n2vc/libjuju.py +++ b/n2vc/libjuju.py @@ -94,7 +94,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, @@ -345,7 +345,7 @@ class Libjuju: db_dict: dict = None, progress_timeout: float = None, total_timeout: float = None, - series: str = "focal", + series: str = "bionic", wait: bool = True, ) -> (Machine, bool): """ @@ -1179,6 +1179,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) @@ -1210,6 +1214,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