Fix bug 2018: Skip exception if model has been removed 63/11963/2
authorDavid Garcia <david.garcia@canonical.com>
Thu, 28 Apr 2022 11:43:36 +0000 (13:43 +0200)
committergarciadav <david.garcia@canonical.com>
Fri, 29 Apr 2022 04:40:13 +0000 (06:40 +0200)
Change-Id: I1d1d6e0c18c7e6a8c42c03a1e39e4673caa0b637
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/libjuju.py

index 8324cd4..6bc9be7 100644 (file)
@@ -1210,6 +1210,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