From dd418a06e63da26a38d5cc2ee483cdf0c1953d2c Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 19 Mar 2025 18:11:30 +0100 Subject: [PATCH] Prevent inventory-manger failing with arbitrary groups In case an arbitrary record is added to openstack_user_config which ends with `_hosts` where metal setup is used, it can result in inventory-mange.py crash as the group will not be mapped. This case is handled now and script will properly display group assigment for this scenario. Related-Bug: #2102132 Change-Id: I73daae0334876399cb429b5a88376474abfef79e --- osa_toolkit/manage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osa_toolkit/manage.py b/osa_toolkit/manage.py index f491b4e3a3..56f2a1f25f 100644 --- a/osa_toolkit/manage.py +++ b/osa_toolkit/manage.py @@ -202,8 +202,12 @@ def print_containers_per_group(inventory): continue # Don't show default group - if len(containers) == 1 and '_' not in containers[0]: - continue + if len(containers) == 1: + if containers[0] is None: + continue + + if '_' not in containers[0]: + continue # Join with newlines here to avoid having a horrific table with tons # of line wrapping.