From 57166c3479af6340bd817635d500b7db12636a43 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 15 Nov 2024 11:19:07 +0100 Subject: [PATCH] Fix cluster-list when VIM is not found from cluster Change-Id: I99b111f575033b402d995b17d728330d1cedd9e8 Signed-off-by: garciadeblas --- osmclient/sol005/cluster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osmclient/sol005/cluster.py b/osmclient/sol005/cluster.py index e5f1614..3225763 100644 --- a/osmclient/sol005/cluster.py +++ b/osmclient/sol005/cluster.py @@ -116,6 +116,10 @@ class Cluster(GenericOSMAPIObject): # Complete cluster info with vim_account name and vim_type vim_list = self._client.vim.list() self._logger.debug(f"VIM list: {vim_list}") + if not vim_list: + self._logger.warning( + "Could not complete cluster info with VIM account info" + ) for item in cluster_list1: vim_id = item["vim_account"] vim_name, vim_type = next( @@ -124,7 +128,7 @@ class Cluster(GenericOSMAPIObject): for vim_item in vim_list if vim_item["_id"] == vim_id or vim_item["name"] == vim_id ), - None, + (None, None), ) item["vim_account"] = f"{vim_name} ({vim_type})" return cluster_list1 -- 2.25.1