From 6650a01a259255585c06417aa86dbe06ea1111be Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Sat, 11 Jul 2026 18:43:53 +0200 Subject: [PATCH] Fix Redfish OEM handler instantiation Fallback paths called OEM handler constructors directly, but these handlers are initialized through async create factories. This caused generic, TSMA, and SMM3 selection to fail with 'OEMHandler() takes no arguments'. Use and await the factories consistently. Also await the asynchronous bmcinfo lookup and forward the TSMA pool argument correctly. --- .../aiohmi/redfish/oem/lenovo/main.py | 10 ++++---- .../aiohmi/redfish/oem/lenovo/tsma.py | 4 ++-- confluent_server/aiohmi/redfish/oem/lookup.py | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/confluent_server/aiohmi/redfish/oem/lenovo/main.py b/confluent_server/aiohmi/redfish/oem/lenovo/main.py index 35ba6bbf..de04ae1b 100644 --- a/confluent_server/aiohmi/redfish/oem/lenovo/main.py +++ b/confluent_server/aiohmi/redfish/oem/lenovo/main.py @@ -39,7 +39,7 @@ async def get_handler(sysinfo, sysurl, webclient, cache, cmd, rootinfo={}): if not leninf: bmcinfo = await cmd.bmcinfo() if 'Ami' in bmcinfo.get('Oem', {}): - return tsma.TsmHandler(sysinfo, sysurl, webclient, cache) + return await tsma.TsmHandler.create(sysinfo, sysurl, webclient, cache, gpool=cmd._gpool) elif 'xclarity controller' in mgrinfo.get('Model', '').lower(): if mgrinfo['Model'].endswith('3'): return await xcc3.OEMHandler.create(sysinfo, sysurl, webclient, cache, @@ -60,9 +60,9 @@ async def get_handler(sysinfo, sysurl, webclient, cache, cmd, rootinfo={}): devdesc = await webclient.grab_json_response_with_status('/DeviceDescription.json') if devdesc[1] == 200: if devdesc[0]['type'].lower() in ('lenovo-smm3', 'smm3'): - return smm3.OEMHandler(sysinfo, sysurl, webclient, cache, - gpool=cmd._gpool) + return await smm3.OEMHandler.create(sysinfo, sysurl, webclient, cache, + gpool=cmd._gpool) except Exception: pass - return generic.OEMHandler(sysinfo, sysurl, webclient, cache, - gpool=cmd._gpool) + return await generic.OEMHandler.create(sysinfo, sysurl, webclient, cache, + gpool=cmd._gpool) diff --git a/confluent_server/aiohmi/redfish/oem/lenovo/tsma.py b/confluent_server/aiohmi/redfish/oem/lenovo/tsma.py index afa4851f..d36d9355 100644 --- a/confluent_server/aiohmi/redfish/oem/lenovo/tsma.py +++ b/confluent_server/aiohmi/redfish/oem/lenovo/tsma.py @@ -101,8 +101,8 @@ class TsmHandler(generic.OEMHandler): @classmethod async def create(cls, sysinfo, sysurl, webclient, cache=None, fish=None, gpool=None): - self = await super(TsmHandler, cls).create(sysinfo, sysurl, webclient, cache, fish, - gpool) + self = await super(TsmHandler, cls).create(sysinfo, sysurl, webclient, cache, + gpool=gpool) if cache is None: cache = {} self._wc = None diff --git a/confluent_server/aiohmi/redfish/oem/lookup.py b/confluent_server/aiohmi/redfish/oem/lookup.py index 210f2dc2..4f528f8d 100644 --- a/confluent_server/aiohmi/redfish/oem/lookup.py +++ b/confluent_server/aiohmi/redfish/oem/lookup.py @@ -27,23 +27,23 @@ OEMMAP = { } -def get_oem_handler(sysinfo, sysurl, webclient, cache, cmd, rootinfo={}): +async def get_oem_handler(sysinfo, sysurl, webclient, cache, cmd, rootinfo={}): if rootinfo.get('Vendor', None) in OEMMAP: - return OEMMAP[rootinfo['Vendor']].get_handler(sysinfo, sysurl, - webclient, cache, cmd, rootinfo) + return await OEMMAP[rootinfo['Vendor']].get_handler(sysinfo, sysurl, + webclient, cache, cmd, rootinfo) for oem in sysinfo.get('Oem', {}): if oem in OEMMAP: - return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, - cmd, rootinfo) + return await OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, + cmd, rootinfo) for oem in sysinfo.get('Links', {}).get('OEM', []): if oem in OEMMAP: - return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, - cmd, rootinfo) + return await OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, + cmd, rootinfo) if rootinfo: # rootinfo indicates early invocation, bmcinfo not ready yet - return generic.OEMHandler(sysinfo, sysurl, webclient, cache, cmd._gpool, rootinfo) - bmcinfo = cmd.bmcinfo + return await generic.OEMHandler.create(sysinfo, sysurl, webclient, cache, cmd._gpool, rootinfo) + bmcinfo = await cmd.bmcinfo() for oem in bmcinfo.get('Oem', {}): if oem in OEMMAP: - return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, - cmd, rootinfo) - return generic.OEMHandler(sysinfo, sysurl, webclient, cache, cmd._gpool, rootinfo) + return await OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache, + cmd, rootinfo) + return await generic.OEMHandler.create(sysinfo, sysurl, webclient, cache, cmd._gpool, rootinfo)