fix 1183: Delete native charms before destroying juju model 53/9553/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 7 Aug 2020 06:36:38 +0000 (06:36 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 7 Aug 2020 06:36:43 +0000 (06:36 +0000)
Destroying the juju model automatically destroys all applications and machines.
However it is not deleted if they are native charms in pending status.

Change-Id: I8b3580e201f1d403d36b6e07fa3947ea4a655683
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_lcm/ns.py

index 9267b45..4bed2c6 100644 (file)
@@ -3225,8 +3225,9 @@ class NsLcm(LcmBase):
                 vca_type = vca.get("type")
                 exec_terminate_primitives = (not operation_params.get("skip_terminate_primitives") and
                                              vca.get("needed_terminate"))
-                # For helm we must destroy_ee
-                destroy_ee = "True" if vca_type == "helm" else "False"
+                # For helm we must destroy_ee. Also for native_charm, as juju_model cannot be deleted if there are
+                # pending native charms
+                destroy_ee = "True" if vca_type in ("helm", "native_charm") else "False"
                 task = asyncio.ensure_future(
                     self.destroy_N2VC(logging_text, db_nslcmop, vca, config_descriptor, vca_index,
                                       destroy_ee, exec_terminate_primitives))