From: garciadeblas Date: Wed, 12 Feb 2025 15:45:40 +0000 (+0100) Subject: Inspect exception during cluster deletion X-Git-Tag: v18.0.0~28 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=926ffac362dce53f390b17ab1fdcb19c8074edcd;p=osm%2FLCM.git Inspect exception during cluster deletion Change-Id: If301ed2c1199450a62554f8f4411e14c41707b8f Signed-off-by: garciadeblas --- diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 104515b7..20d47a57 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -577,27 +577,34 @@ class ClusterLcm(GitOpsLcm): async def delete(self, params, order_id): self.logger.info("cluster delete Enter") - # To get the cluster and op ids - cluster_id = params["cluster_id"] - op_id = params["operation_id"] + try: + # To get the cluster and op ids + cluster_id = params["cluster_id"] + op_id = params["operation_id"] - # To initialize the operation states - self.initialize_operation(cluster_id, op_id) + # To initialize the operation states + self.initialize_operation(cluster_id, op_id) - # To get the cluster - db_cluster = self.db.get_one("clusters", {"_id": cluster_id}) + # To get the cluster + db_cluster = self.db.get_one("clusters", {"_id": cluster_id}) - # To get the operation params details - op_params = self.get_operation_params(db_cluster, op_id) + # To get the operation params details + op_params = self.get_operation_params(db_cluster, op_id) - # To copy the cluster content and decrypting fields to use in workflows - workflow_content = { - "cluster": self.decrypted_copy(db_cluster), - } + # To copy the cluster content and decrypting fields to use in workflows + workflow_content = { + "cluster": self.decrypted_copy(db_cluster), + } - # To get the vim account details - db_vim = self.db.get_one("vim_accounts", {"name": db_cluster["vim_account"]}) - workflow_content["vim_account"] = db_vim + # To get the vim account details + db_vim = self.db.get_one( + "vim_accounts", {"name": db_cluster["vim_account"]} + ) + workflow_content["vim_account"] = db_vim + except Exception as e: + self.logger.debug(traceback.format_exc()) + self.logger.debug(f"Exception: {e}", exc_info=True) + raise e workflow_res, workflow_name = await self.odu.launch_workflow( "delete_cluster", op_id, op_params, workflow_content