From: David Garcia Date: Wed, 8 Jun 2022 09:16:54 +0000 (+0200) Subject: Fix bug 2061: Ignore "model not found" exception when deleting models X-Git-Tag: v11.0.3^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=9ff6d13ef40552de8acde099b9181ed488ab73b8;p=osm%2FN2VC.git Fix bug 2061: Ignore "model not found" exception when deleting models Change-Id: Ife06b41bf2bcf32b080b405e607450d9303d19e0 Signed-off-by: David Garcia --- diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py index 4631859..d1b5ed6 100644 --- a/n2vc/libjuju.py +++ b/n2vc/libjuju.py @@ -1298,14 +1298,17 @@ class Libjuju: self.log.info(f"Model {model_name} deleted forcefully") try: - await asyncio.wait_for( - _destroy_model_gracefully(model_name, controller), timeout=120 - ) - except asyncio.TimeoutError: - await _destroy_model_forcefully(model_name, controller) + try: + await asyncio.wait_for( + _destroy_model_gracefully(model_name, controller), timeout=120 + ) + except asyncio.TimeoutError: + await _destroy_model_forcefully(model_name, controller) except juju.errors.JujuError as e: if any("has been removed" in error for error in e.errors): return + if any("model not found" in error for error in e.errors): + return raise e async def destroy_application(