mirror of
https://github.com/xcat2/confluent.git
synced 2026-10-15 08:12:04 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user