From 6b2112c1c60933a2f636045f0d516a3c56df6898 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 20 Dec 2024 10:35:13 +0100 Subject: [PATCH] Add workaround to avoid infinite loop in cluster deregistration Change-Id: Ia921b23433d1ba0450e96aaac9e4b4d1370977c1 Signed-off-by: garciadeblas --- osm_lcm/k8s.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 70dee64d..ab6001b7 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -563,6 +563,8 @@ class ClusterLcm(GitOpsLcm): # To copy the cluster content and decrypting the key to use in workflows db_cluster_copy = self.decrypting_key(db_cluster) + # 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) @@ -991,6 +993,9 @@ 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) -- 2.25.1