From: tierno Date: Mon, 20 Apr 2020 16:28:56 +0000 (+0000) Subject: fixes at exception captures and k8srepo deletion X-Git-Tag: v7.1.0rc1~7 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F8803%2F4;p=osm%2FLCM.git fixes at exception captures and k8srepo deletion Change-Id: I4883091979f3f4ef61d9808b8723059ed0cb588d Signed-off-by: tierno --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index b7805d7..704b921 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -2968,7 +2968,8 @@ class NsLcm(LcmBase): new_error = created_tasks_info[task] + ": {}".format(exc) error_list.append(created_tasks_info[task]) error_detail_list.append(new_error) - if isinstance(exc, (str, DbException, N2VCException, ROclient.ROClientException, LcmException)): + if isinstance(exc, (str, DbException, N2VCException, ROclient.ROClientException, LcmException, + K8sException)): self.logger.error(logging_text + new_error) else: exc_traceback = "".join(traceback.format_exception(None, exc, exc.__traceback__)) diff --git a/osm_lcm/vim_sdn.py b/osm_lcm/vim_sdn.py index 348f292..6593b46 100644 --- a/osm_lcm/vim_sdn.py +++ b/osm_lcm/vim_sdn.py @@ -1100,7 +1100,7 @@ class K8sClusterLcm(LcmBase): # raise Exception("K8scluster was not properly removed") except Exception as e: - if isinstance(e, LcmException, DbException): + if isinstance(e, (LcmException, DbException)): self.logger.error(logging_text + "Exit Exception {}".format(e)) else: self.logger.critical(logging_text + "Exit Exception {}".format(e), exc_info=True) @@ -1216,6 +1216,7 @@ class K8sRepoLcm(LcmBase): db_k8srepo = None db_k8srepo_update = {} + exc = None operationState_HA = '' detailed_status_HA = '' try: @@ -1241,6 +1242,7 @@ class K8sRepoLcm(LcmBase): self.lcm_tasks.register_HA('k8srepo', 'delete', op_id, operationState=operationState_HA, detailed_status=detailed_status_HA) + self.db.del_one("k8srepos", {"_id": k8srepo_id}) except DbException as e: self.logger.error(logging_text + "Cannot update database: {}".format(e)) self.lcm_tasks.remove("k8srepo", k8srepo_id, order_id)