Fixes VCA deletion in NS termination 72/14272/1
authorGabriel Cuba <gcuba@whitestack.com>
Thu, 21 Mar 2024 22:14:05 +0000 (17:14 -0500)
committerGabriel Cuba <gcuba@whitestack.com>
Thu, 21 Mar 2024 22:14:05 +0000 (17:14 -0500)
Change-Id: I3abfed8a389620cdc1ef8207a53c53c8c7ba6854
Signed-off-by: Gabriel Cuba <gcuba@whitestack.com>
osm_lcm/ns.py

index 57298bd..8e42ddc 100644 (file)
@@ -4522,16 +4522,8 @@ class NsLcm(LcmBase):
             if nsr_deployed.get("VCA"):
                 stage[1] = "Deleting all execution environments."
                 self.logger.debug(logging_text + stage[1])
-                if nsr_deployed.get("VCA").get("type") != "helm-v3":
-                    vca_id = self.get_vca_id({}, db_nsr)
-                    task_delete_ee = asyncio.ensure_future(
-                        asyncio.wait_for(
-                            self._delete_all_N2VC(db_nsr=db_nsr, vca_id=vca_id),
-                            timeout=self.timeout.charm_delete,
-                        )
-                    )
-                    tasks_dict_info[task_delete_ee] = "Terminating all VCA"
-                else:
+                helm_vca_list = get_deployed_vca(db_nsr, {"type": "helm-v3"})
+                if helm_vca_list:
                     # Delete Namespace and Certificates
                     await self.vca_map["helm-v3"].delete_tls_certificate(
                         namespace=db_nslcmop["nsInstanceId"],
@@ -4540,6 +4532,15 @@ class NsLcm(LcmBase):
                     await self.vca_map["helm-v3"].delete_namespace(
                         namespace=db_nslcmop["nsInstanceId"],
                     )
+                else:
+                    vca_id = self.get_vca_id({}, db_nsr)
+                    task_delete_ee = asyncio.ensure_future(
+                        asyncio.wait_for(
+                            self._delete_all_N2VC(db_nsr=db_nsr, vca_id=vca_id),
+                            timeout=self.timeout.charm_delete,
+                        )
+                    )
+                    tasks_dict_info[task_delete_ee] = "Terminating all VCA"
 
             # Delete from k8scluster
             stage[1] = "Deleting KDUs."