X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=n2vc%2Flibjuju.py;h=5ed1d679760a7c620831736511219cc81c00b665;hb=refs%2Fchanges%2F43%2F12143%2F1;hp=0c0180f30021e1b0799caa597df3ede84cf97f10;hpb=83566f5510fcba0453459e6ba7d99550096bf0d0;p=osm%2FN2VC.git diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py index 0c0180f..5ed1d67 100644 --- a/n2vc/libjuju.py +++ b/n2vc/libjuju.py @@ -122,7 +122,10 @@ class Libjuju: ) if controller: await self.disconnect_controller(controller) - raise JujuControllerFailedConnecting(e) + + raise JujuControllerFailedConnecting( + f"Error connecting to Juju controller: {e}" + ) async def disconnect(self): """Disconnect""" @@ -1223,6 +1226,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 +1261,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