Fix 2328: In NS deletion, remove EE objects according to the VCA type
[osm/LCM.git] / osm_lcm / lcm_utils.py
index 12fd7fb..af460d2 100644 (file)
@@ -448,6 +448,26 @@ class LcmBase:
             self.logger.error(f"{error} occured while getting the charm name")
             raise LcmException(error)
 
+    def get_vca_info(self, ee_item, db_nsr, get_charm_name: bool):
+        vca_name = charm_name = vca_type = None
+        if ee_item.get("juju"):
+            vca_name = ee_item["juju"].get("charm")
+            if get_charm_name:
+                charm_name = self.find_charm_name(db_nsr, str(vca_name))
+            vca_type = (
+                "lxc_proxy_charm"
+                if ee_item["juju"].get("charm") is not None
+                else "native_charm"
+            )
+            if ee_item["juju"].get("cloud") == "k8s":
+                vca_type = "k8s_proxy_charm"
+            elif ee_item["juju"].get("proxy") is False:
+                vca_type = "native_charm"
+        elif ee_item.get("helm-chart"):
+            vca_name = ee_item["helm-chart"]
+            vca_type = "helm-v3"
+        return vca_name, charm_name, vca_type
+
 
 class TaskRegistry(LcmBase):
     """