From: shrinithi Date: Fri, 10 Jan 2025 10:58:12 +0000 (+0000) Subject: Removing cluster deregister workaround X-Git-Tag: v18.0.0~38 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F14862%2F6;p=osm%2FLCM.git Removing cluster deregister workaround Change-Id: Ibcf79b9ae29353721f9118d2f6871e84833c1b1e Signed-off-by: shrinithi Signed-off-by: garciadeblas --- diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 952760e9..634f68b3 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -434,7 +434,6 @@ class ClusterLcm(GitOpsLcm): self.logger.info( f"check_create_cluster Operation {op_id}. Params: {op_params}." ) - # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] cluster_name = db_cluster["git_name"].lower() cluster_kustomization_name = cluster_name @@ -536,7 +535,6 @@ class ClusterLcm(GitOpsLcm): self.logger.info("the db_cluster is :{}".format(db_cluster)) for profile_type in profiles: profile_id = db_cluster[profile_type] - # db_collection = profiles_collection[profile_type] db_collection = self.profile_collection_mapping[profile_type] db_profile = self.db.get_one(db_collection, {"_id": profile_id}) op_id = db_profile["operationHistory"][-1].get("op_id") @@ -575,11 +573,6 @@ class ClusterLcm(GitOpsLcm): db_vim = self.db.get_one("vim_accounts", {"name": db_cluster["vim_account"]}) workflow_content["vim_account"] = db_vim - # TODO: workaround until NBI rejects cluster deletion requests for registered clusters - # This if clause will be removed - if db_cluster["created"] == "false": - return await self.deregister(params, order_id) - workflow_res, workflow_name = await self.odu.launch_workflow( "delete_cluster", op_id, op_params, workflow_content ) @@ -700,9 +693,6 @@ class ClusterLcm(GitOpsLcm): def delete_cluster(self, db_cluster): # Actually, item_content is equal to db_cluster - # item_content = self.db.get_one("clusters", {"_id": db_cluster["_id"]}) - # self.logger.debug("item_content is : {}".format(item_content)) - # detach profiles update_dict = None profiles_to_detach = [ @@ -724,7 +714,6 @@ class ClusterLcm(GitOpsLcm): profile_ids = db_cluster[profile_type] profile_ids_copy = deepcopy(profile_ids) for profile_id in profile_ids_copy: - # db_collection = profiles_collection[profile_type] db_collection = self.profile_collection_mapping[profile_type] db_profile = self.db.get_one(db_collection, {"_id": profile_id}) self.logger.debug("the db_profile is :{}".format(db_profile)) @@ -859,7 +848,6 @@ class ClusterLcm(GitOpsLcm): profile_collection = self.profile_collection_mapping[profile_type] db_profile = self.db.get_one(profile_collection, {"_id": profile_id}) db_profile["profile_type"] = profile_type - # content["profile"] = db_profile workflow_content["profile"] = db_profile workflow_res, workflow_name = await self.odu.launch_workflow( @@ -1139,9 +1127,6 @@ class ClusterLcm(GitOpsLcm): db_cluster = self.update_operation_history( db_cluster, op_id, workflow_status, resource_status ) - # TODO: workaround until NBI rejects cluster deletion requests for registered clusters - # Setting created flag to true avoids infinite loops when deregistering a cluster - db_cluster["created"] = "true" self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster) return await self.delete(params, order_id)