@@ -538,16 +538,16 @@ def get(self, app_id):
538538 if not cluster :
539539 return dict (status = 'fail' , message = f'Cluster with id { project .cluster_id } does not exist' ), 404
540540
541- kube_client = create_kube_clients (cluster .host , cluster .token )
541+ kube_client = create_kube_clients (cluster .host , cluster .token )
542542 try :
543543 app_status_object = kube_client .appsv1_api .read_namespaced_deployment_status (
544544 f"{ app_list ['alias' ]} -deployment" , project .alias )
545545 except client .rest .ApiException as exc :
546546 if exc .status == 404 :
547547 return dict (status = 'fail' , data = dict (apps = app_list ), message = "Application does not exist on the cluster" ), 200
548548 return dict (status = 'fail' , data = dict (apps = app_list ), message = str (exc )), 500
549-
550549 app_list .update (self .extract_app_details (app_status_object ))
550+
551551 app_list ["pod_statuses" ] = self .get_pod_statuses (
552552 kube_client , project .alias , app_list ['alias' ])
553553
@@ -581,8 +581,12 @@ def extract_app_details(app_status_object):
581581
582582 @staticmethod
583583 def get_pod_statuses (kube_client , namespace , app_alias ):
584- pods = kube_client .kube .list_namespaced_pod (
585- namespace , label_selector = f"app={ app_alias } " )
584+ try :
585+ pods = kube_client .kube .list_namespaced_pod (
586+ namespace , label_selector = f"app={ app_alias } " )
587+ except Exception as e :
588+ current_app .logger .error (f"Error fetching pods: { str (e )} " )
589+ return []
586590 pod_statuses = []
587591
588592 for i , pod in enumerate (pods .items ):
0 commit comments