Fix cluster-list when VIM is not found from cluster 34/14734/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 15 Nov 2024 10:19:07 +0000 (11:19 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 15 Nov 2024 10:19:16 +0000 (11:19 +0100)
Change-Id: I99b111f575033b402d995b17d728330d1cedd9e8
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/sol005/cluster.py

index e5f1614..3225763 100644 (file)
@@ -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