diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 104515b76bdbf6a034bf1c149ebfefd37974cbfe..20d47a57974322f87d0fc29f31bc982af544d4e0 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