- print(db_k8scluster.get("credentials"))
- print("\n\n\n FIN CREDENTIALS")
- print(yaml.safe_dump(db_k8scluster.get("credentials")))
- print("\n\n\n FIN OUTPUT")
- cluster_uuid, uninstall_sw = await self.k8scluster.init_env(yaml.safe_dump(db_k8scluster.
- get("credentials")))
- db_k8scluster_update["cluster-uuid"] = cluster_uuid
- if uninstall_sw:
- db_k8scluster_update["uninstall-sw"] = uninstall_sw
- step = "Getting the list of repos"
- self.logger.debug(logging_text + step)
- task_list = []
- db_k8srepo_list = self.db.get_list("k8srepos", {})
- for repo in db_k8srepo_list:
- step = "Adding repo {} to cluster: {}".format(repo["name"], cluster_uuid)
- self.logger.debug(logging_text + step)
- task = asyncio.ensure_future(self.k8scluster.repo_add(cluster_uuid=cluster_uuid,
- name=repo["name"], url=repo["url"],
- repo_type="chart"))
- task_list.append(task)
- if not repo["_admin"].get("cluster-inserted"):
- repo["_admin"]["cluster-inserted"] = []
- repo["_admin"]["cluster-inserted"].append(cluster_uuid)
- self.update_db_2("k8srepos", repo["_id"], repo)
-
- done = None
- pending = None
- if len(task_list) > 0:
- self.logger.debug('Waiting for terminate pending tasks...')
- done, pending = await asyncio.wait(task_list, timeout=3600)
- if not pending:
- self.logger.debug('All tasks finished...')
+ k8s_credentials = yaml.safe_dump(db_k8scluster.get("credentials"))
+ error_text_list = []
+ # helm-chart
+ k8s_hc_id = None
+ try:
+ k8s_hc_id, uninstall_sw = await self.helm_k8scluster.init_env(k8s_credentials)
+ db_k8scluster_update["_admin.helm-chart.id"] = k8s_hc_id
+ db_k8scluster_update["_admin.helm-chart.created"] = uninstall_sw
+ except Exception as e:
+ error_text_list.append("Failing init helm-chart: {}".format(e))
+ db_k8scluster_update["_admin.helm-chart.error_msg"] = str(e)
+ if isinstance(e, K8sException):
+ self.logger.error(logging_text + "Failing init helm-chart: {}".format(e))