Fix bug 2016: Skip exception if model has been removed 61/11961/2
authorDavid Garcia <david.garcia@canonical.com>
Thu, 28 Apr 2022 11:43:36 +0000 (13:43 +0200)
committergarciadav <david.garcia@canonical.com>
Thu, 28 Apr 2022 13:19:05 +0000 (15:19 +0200)
Change-Id: I1d1d6e0c18c7e6a8c42c03a1e39e4673caa0b637
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/libjuju.py

index 0c0180f..028cea8 100644 (file)
@@ -1254,6 +1254,10 @@ class Libjuju:
             raise Exception(
                 "Timeout waiting for model {} to be destroyed".format(model_name)
             )
             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
 
     async def destroy_application(
         self, model_name: str, application_name: str, total_timeout: float