Deregister cluster when delete cluster is called for imported clusters 42/14742/4 master
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 18 Nov 2024 09:33:12 +0000 (10:33 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 18 Nov 2024 16:10:49 +0000 (17:10 +0100)
Change-Id: I1387104d0e91bf997137d16d00d69f43623d5edf
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/k8s.py

index 845a396..fb4a063 100644 (file)
@@ -323,6 +323,8 @@ class ClusterLcm(GitOpsLcm):
     async def delete(self, op_id, op_params, content):
         self.logger.info("cluster delete Enter")
         db_cluster = content["cluster"]
     async def delete(self, op_id, op_params, content):
         self.logger.info("cluster delete Enter")
         db_cluster = content["cluster"]
+        if db_cluster["created"] == "false":
+            return await self.deregister(op_id, op_params, content)
 
         _, workflow_name = await self.odu.launch_workflow(
             "delete_cluster", op_id, op_params, content
 
         _, workflow_name = await self.odu.launch_workflow(
             "delete_cluster", op_id, op_params, content