projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Feature-9904: Enhancing NG-UI to enable Juju operational view dashboard
[osm/N2VC.git]
/
n2vc
/
k8s_helm_conn.py
diff --git
a/n2vc/k8s_helm_conn.py
b/n2vc/k8s_helm_conn.py
index
e3b51ba
..
13a69c4
100644
(file)
--- a/
n2vc/k8s_helm_conn.py
+++ b/
n2vc/k8s_helm_conn.py
@@
-837,6
+837,7
@@
class K8sHelmConnector(K8sConnector):
kdu_instance: str,
namespace: str) -> list:
kdu_instance: str,
namespace: str) -> list:
+ _, cluster_id = self._get_namespace_cluster_id(cluster_uuid)
self.log.debug(
"get_services: cluster_uuid: {}, kdu_instance: {}".format(
cluster_uuid, kdu_instance
self.log.debug(
"get_services: cluster_uuid: {}, kdu_instance: {}".format(
cluster_uuid, kdu_instance
@@
-844,7
+845,7
@@
class K8sHelmConnector(K8sConnector):
)
status = await self._status_kdu(
)
status = await self._status_kdu(
- cluster_
uu
id, kdu_instance, return_text=False
+ cluster_id, kdu_instance, return_text=False
)
service_names = self._parse_helm_status_service_info(status)
)
service_names = self._parse_helm_status_service_info(status)
@@
-866,8
+867,9
@@
class K8sHelmConnector(K8sConnector):
)
# get paths
)
# get paths
+ _, cluster_id = self._get_namespace_cluster_id(cluster_uuid)
_kube_dir, helm_dir, config_filename, _cluster_dir = self._get_paths(
_kube_dir, helm_dir, config_filename, _cluster_dir = self._get_paths(
- cluster_name=cluster_
uu
id, create_if_not_exist=True
+ cluster_name=cluster_id, create_if_not_exist=True
)
command = "{} --kubeconfig={} --namespace={} get service {} -o=yaml".format(
)
command = "{} --kubeconfig={} --namespace={} get service {} -o=yaml".format(
@@
-896,7
+898,7
@@
class K8sHelmConnector(K8sConnector):
async def synchronize_repos(self, cluster_uuid: str):
_, cluster_id = self._get_namespace_cluster_id(cluster_uuid)
async def synchronize_repos(self, cluster_uuid: str):
_, cluster_id = self._get_namespace_cluster_id(cluster_uuid)
- self.log.debug("syncronize repos for cluster helm-id: {}"
,
)
+ self.log.debug("syncronize repos for cluster helm-id: {}"
.format(cluster_id)
)
try:
update_repos_timeout = (
300 # max timeout to sync a single repos, more than this is too much
try:
update_repos_timeout = (
300 # max timeout to sync a single repos, more than this is too much
@@
-914,8
+916,8
@@
class K8sHelmConnector(K8sConnector):
# elements that must be deleted
deleted_repo_list = []
added_repo_dict = {}
# elements that must be deleted
deleted_repo_list = []
added_repo_dict = {}
- self.log.debug("helm_chart_repos: {}".format(nbi_repo_list))
- self.log.debug("helm_charts_added: {}".format(cluster_repo_dict))
+
#
self.log.debug("helm_chart_repos: {}".format(nbi_repo_list))
+
#
self.log.debug("helm_charts_added: {}".format(cluster_repo_dict))
# obtain repos to add: registered by nbi but not added
repos_to_add = [
# obtain repos to add: registered by nbi but not added
repos_to_add = [
@@
-932,7
+934,8
@@
class K8sHelmConnector(K8sConnector):
# delete repos: must delete first then add because there may be
# different repos with same name but
# different id and url
# delete repos: must delete first then add because there may be
# different repos with same name but
# different id and url
- self.log.debug("repos to delete: {}".format(repos_to_delete))
+ if repos_to_delete:
+ self.log.debug("repos to delete: {}".format(repos_to_delete))
for repo_id in repos_to_delete:
# try to delete repos
try:
for repo_id in repos_to_delete:
# try to delete repos
try:
@@
-955,7
+958,8
@@
class K8sHelmConnector(K8sConnector):
deleted_repo_list.append(repo_id)
# add repos
deleted_repo_list.append(repo_id)
# add repos
- self.log.debug("repos to add: {}".format(repos_to_add))
+ if repos_to_add:
+ self.log.debug("repos to add: {}".format(repos_to_add))
for repo_id in repos_to_add:
# obtain the repo data from the db
# if there is an error getting the repo in the database we will
for repo_id in repos_to_add:
# obtain the repo data from the db
# if there is an error getting the repo in the database we will
@@
-1134,6
+1138,7
@@
class K8sHelmConnector(K8sConnector):
db_dict: dict = None,
run_once: bool = False,
):
db_dict: dict = None,
run_once: bool = False,
):
+ previous_exception = None
while True:
try:
await asyncio.sleep(check_every)
while True:
try:
await asyncio.sleep(check_every)
@@
-1157,8
+1162,10
@@
class K8sHelmConnector(K8sConnector):
self.log.debug("Task cancelled")
return
except Exception as e:
self.log.debug("Task cancelled")
return
except Exception as e:
- self.log.debug("_store_status exception: {}".format(str(e)), exc_info=True)
- pass
+ # log only once in the while loop
+ if str(previous_exception) != str(e):
+ self.log.debug("_store_status exception: {}".format(str(e)))
+ previous_exception = e
finally:
if run_once:
return
finally:
if run_once:
return