X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=n2vc%2Flibjuju.py;h=7b01d5d86debd8a87184b732defd0fb3609e8e38;hb=9fb1665e1264d139ae8aa9b7db1b3f3329d6683a;hp=8324cd42d54eb37788cf1704dad485163b97d9e6;hpb=85b467faa66414857be13995caca4806df6708cf;p=osm%2FN2VC.git diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py index 8324cd4..7b01d5d 100644 --- a/n2vc/libjuju.py +++ b/n2vc/libjuju.py @@ -121,7 +121,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""" @@ -1179,6 +1182,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 +1217,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