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):
"""
)
)
ee_descriptor_id = ee_item.get("id")
- 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"
- else:
+ vca_name, charm_name, vca_type = self.get_vca_info(
+ ee_item, db_nsr, get_charm_name
+ )
+ if not vca_type:
self.logger.debug(
- logging_text + "skipping non juju neither charm configuration"
+ logging_text + "skipping, non juju/charm/helm configuration"
)
continue
if nsr_deployed.get("VCA"):
stage[1] = "Deleting all execution environments."
self.logger.debug(logging_text + stage[1])
- 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,
+ 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:
+ # Delete Namespace and Certificates
+ await self.vca_map["helm-v3"].delete_tls_certificate(
+ namespace=db_nslcmop["nsInstanceId"],
+ certificate_name=self.EE_TLS_NAME,
+ )
+ await self.vca_map["helm-v3"].delete_namespace(
+ namespace=db_nslcmop["nsInstanceId"],
)
- )
- # task_delete_ee = asyncio.ensure_future(self.n2vc.delete_namespace(namespace="." + nsr_id))
- tasks_dict_info[task_delete_ee] = "Terminating all VCA"
-
- # Delete Namespace and Certificates if necessary
- if check_helm_ee_in_ns(list(db_vnfds_from_member_index.values())):
- await self.vca_map["helm-v3"].delete_tls_certificate(
- namespace=db_nslcmop["nsInstanceId"],
- certificate_name=self.EE_TLS_NAME,
- )
- await self.vca_map["helm-v3"].delete_namespace(
- namespace=db_nslcmop["nsInstanceId"],
- )
# Delete from k8scluster
stage[1] = "Deleting KDUs."
)
)
ee_descriptor_id = ee_item.get("id")
- 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"
- else:
+ vca_name, charm_name, vca_type = self.get_vca_info(
+ ee_item, db_nsr, get_charm_name
+ )
+ if not vca_type:
self.logger.debug(
- logging_text + "skipping non juju neither charm configuration"
+ logging_text + "skipping, non juju/charm/helm configuration"
)
continue