fix issues with k8scluster and repos 79/8679/2
authortierno <alfonso.tiernosepulveda@telefonica.com>
Thu, 12 Mar 2020 17:19:06 +0000 (17:19 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Thu, 12 Mar 2020 23:05:12 +0000 (23:05 +0000)
Change-Id: I3a1487b5d76b9c2c44ce6a2988d174b4ab7ad522
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_lcm/ns.py
osm_lcm/vim_sdn.py

index 0bee4a1..8705823 100644 (file)
@@ -2095,11 +2095,11 @@ class NsLcm(LcmBase):
                                     unset = {'_admin.helm_charts_added.' + item: None for item in del_repo_list}
                                     updated = {'_admin.helm_charts_added.' +
                                                item: name for item, name in added_repo_dict.items()}
-                                    self.logger.debug("repos synchronized, to_delete: {}, to_add: {}".
+                                    self.logger.debug(logging_text + "repos synchronized, to_delete: {}, to_add: {}".
                                                       format(del_repo_list, added_repo_dict))
                                     self.db.set_one("k8sclusters", {"_id": kdur["k8s-cluster"]["id"]},
                                                     updated, unset=unset)
-                            updated_cluster_list.append(cluster_uuid)
+                                updated_cluster_list.append(cluster_uuid)
 
                     except LcmException as e:
                         error_text = str(e)
index 6b1a338..348f292 100644 (file)
@@ -1042,7 +1042,7 @@ class K8sClusterLcm(LcmBase):
                                            detailed_status=detailed_status_HA)
             except DbException as e:
                 self.logger.error(logging_text + "Cannot update database: {}".format(e))
-            self.lcm_tasks.remove("k8sclusters", k8scluster_id, order_id)
+            self.lcm_tasks.remove("k8scluster", k8scluster_id, order_id)
 
     async def delete(self, k8scluster_content, order_id):
 
@@ -1100,7 +1100,10 @@ class K8sClusterLcm(LcmBase):
             #     raise Exception("K8scluster was not properly removed")
 
         except Exception as e:
-            self.logger.critical(logging_text + "Exit Exception {}".format(e), exc_info=True)
+            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)
             exc = e
         finally:
             if exc and db_k8scluster:
@@ -1119,7 +1122,7 @@ class K8sClusterLcm(LcmBase):
                                            detailed_status=detailed_status_HA)
             except DbException as e:
                 self.logger.error(logging_text + "Cannot update database: {}".format(e))
-            self.lcm_tasks.remove("k8sclusters", k8scluster_id, order_id)
+            self.lcm_tasks.remove("k8scluster", k8scluster_id, order_id)
 
 
 class K8sRepoLcm(LcmBase):