X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fk8s_helm_conn.py;h=8b93edcefbd4b45fa053313231fd5369c50e1c59;hp=fdfc443468ee3ccd820c9fb103c690371adebe32;hb=119f723a2c75544b3698ca63ab305c0eed59f453;hpb=4fee80e46dff88732b7927e502007203fcd8a15c diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index fdfc443..8b93edc 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -124,9 +124,8 @@ class K8sHelmConnector(K8sConnector): _kube_dir, helm_dir, config_filename, _cluster_dir = self._get_paths( cluster_name=cluster_uuid, create_if_not_exist=True ) - f = open(config_filename, "w") - f.write(k8s_creds) - f.close() + with open(config_filename, "w") as f: + f.write(k8s_creds) # check if tiller pod is up in cluster command = "{} --kubeconfig={} --namespace={} get deployments".format( @@ -136,7 +135,7 @@ class K8sHelmConnector(K8sConnector): command=command, raise_exception_on_error=True ) - output_table = K8sHelmConnector._output_to_table(output=output) + output_table = self._output_to_table(output=output) # find 'tiller' pod in all pods already_initialized = False @@ -1052,12 +1051,12 @@ class K8sHelmConnector(K8sConnector): while True: try: await asyncio.sleep(check_every) - detailed_status = await self.status_kdu( - cluster_uuid=cluster_uuid, kdu_instance=kdu_instance + detailed_status = await self._status_kdu( + cluster_uuid=cluster_uuid, kdu_instance=kdu_instance, + return_text=False ) status = detailed_status.get("info").get("Description") - self.log.debug("STATUS:\n{}".format(status)) - self.log.debug("DETAILED STATUS:\n{}".format(detailed_status)) + self.log.debug('KDU {} STATUS: {}.'.format(kdu_instance, status)) # write status to db result = await self.write_app_status_to_db( db_dict=db_dict,