Skip to content

Commit 36821f8

Browse files
Return cluster information regardless of cluster connection failures (#599)
* return cluster information regardless of cluster connection failures * refactor code * format code
1 parent 8c4f494 commit 36821f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/controllers/clusters.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ def get(self, cluster_id):
142142
cluster=json.loads(validated_cluster_data),
143143
resource_count=json.loads(resource_count_json))
144144
), 200
145+
146+
except client.rest.ApiException as e:
147+
error_message = "Could not access cluster or invalid token, please reset your cluster token." \
148+
if e.status == 401 or "Unauthorized" in str(e) else str(e)
149+
return dict(status='fail', data=dict( cluster=json.loads(validated_cluster_data), resource_count=[]),cluster_error=error_message), 200
145150

146151
except Exception as e:
147152
return dict(status='fail', message=str(e)), 500

0 commit comments

Comments
 (0)