From 8bdb3d450960476bfff6ffed57667ddd91bd1272 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 4 Apr 2025 00:19:13 +0200 Subject: [PATCH] Update profile state and agekeys during cluster registration Change-Id: I612f4fa22d2008f740f5d60c3692d8094d7a2842 Signed-off-by: garciadeblas --- osm_lcm/k8s.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index cd22a995..21df2b18 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -353,6 +353,8 @@ class ClusterLcm(GitOpsLcm): async def create(self, params, order_id): self.logger.info("cluster Create Enter") + workflow_status = None + resource_status = None # To get the cluster and op ids cluster_id = params["cluster_id"] @@ -980,6 +982,8 @@ class ClusterLcm(GitOpsLcm): async def register(self, params, order_id): self.logger.info("cluster register enter") + workflow_status = None + resource_status = None # To get the cluster and op ids cluster_id = params["cluster_id"] @@ -995,8 +999,9 @@ class ClusterLcm(GitOpsLcm): op_params = self.get_operation_params(db_cluster, op_id) # To copy the cluster content and decrypting fields to use in workflows + db_cluster_copy = self.decrypted_copy(db_cluster) workflow_content = { - "cluster": self.decrypted_copy(db_cluster), + "cluster": db_cluster_copy, } workflow_res, workflow_name = await self.odu.launch_workflow( @@ -1069,6 +1074,10 @@ class ClusterLcm(GitOpsLcm): db_cluster["current_operation"] = None self.db.set_one("clusters", {"_id": db_cluster["_id"]}, db_cluster) + # Update default profile agekeys and state + self.update_default_profile_agekeys(db_cluster_copy) + self.update_profile_state(db_cluster, workflow_status, resource_status) + db_register = self.db.get_one("k8sclusters", {"name": db_cluster["name"]}) db_register["credentials"] = db_cluster["credentials"] self.db.set_one("k8sclusters", {"_id": db_register["_id"]}, db_register) -- 2.25.1