From 6ce03f5081db65cba1c8bb5f975aa5f99a7a9d0e Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 14 Aug 2026 03:05:13 +0200 Subject: [PATCH] Call a firmware entry something that identifies it This bmc gives all three of its firmware entries the same Name, "Software Inventory", and puts what they actually are in the description. The first entry took that name, and the two after it fell back to their ids, so nodefirmware answered with "Software Inventory", "cpld_active" and "d1dc9e4b" for what are the host, cpld and bmc images. Decide the labels across the collection rather than one entry at a time, so a name the platform repeats can be recognised as no name at all. Where that happens, use a description that does tell them apart, and the id when even that is shared. A platform whose names are already distinct keeps exactly the names it had. The labels are what a caller addresses an entry by, so this also turns inventory/firmware/all/d1dc9e4b into inventory/firmware/all/bmc_image. --- confluent_server/aiohmi/redfish/command.py | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/confluent_server/aiohmi/redfish/command.py b/confluent_server/aiohmi/redfish/command.py index 11074287..a0944879 100644 --- a/confluent_server/aiohmi/redfish/command.py +++ b/confluent_server/aiohmi/redfish/command.py @@ -1329,8 +1329,11 @@ class Command(object): fwurls = [x['@odata.id'] for x in fwlist.get('Members', [])] wantcategory = category if category not in (None, 'all') else None entries = [] - async for res in self._do_bulk_requests(fwurls): - entries.append((self._fwcategory(res[0]), self._extract_fwinfo(res))) + results = [res async for res in self._do_bulk_requests(fwurls)] + labels = self._firmware_labels(results) + for res in results: + entries.append((self._fwcategory(res[0]), + self._extract_fwinfo(res, labels))) categorised = any(x[0] for x in entries) for fwcategory, res in entries: if res[0] is None: @@ -1346,10 +1349,32 @@ class Command(object): continue yield res - def _extract_fwinfo(self, inf): + def _firmware_labels(self, results): + """Pick something to call each firmware entry. + + A platform is free to give every entry the same Name, which then tells + them apart from nothing, so where that happens look for a description + that does, and fall back to the id. + """ + names = [x[0].get('Name', 'Unknown') for x in results] + descs = [x[0].get('Description', '') for x in results] + labels = {} + for idx, (fwi, url) in enumerate(results): + label = names[idx] + if names.count(label) > 1: + if descs[idx] and descs.count(descs[idx]) == 1: + label = descs[idx] + else: + label = fwi.get('Id', label) + labels[url] = label + return labels + + def _extract_fwinfo(self, inf, labels=None): currinf = self._oem._extract_fwinfo(inf) fwi, url = inf fwname = fwi.get('Name', 'Unknown') + if labels: + fwname = labels.get(url, fwname) if fwname in self._fwnamemap: fwname = fwi.get('Id', fwname) if fwname in self._fwnamemap: