mirror of
https://opendev.org/x/pyghmi
synced 2026-01-11 18:52:33 +00:00
Tolerate variant of TSMA without sys OEM
If no OEM element in the sysinfo, check the manager. Change-Id: I038ae3edcb82acebd33805723f18e1181b3d3d52
This commit is contained in:
@@ -518,6 +518,10 @@ class Command(object):
|
||||
def sysinfo(self):
|
||||
return self._do_web_request(self.sysurl)
|
||||
|
||||
@property
|
||||
def bmcinfo(self):
|
||||
return self._do_web_request(self._bmcurl)
|
||||
|
||||
def get_power(self):
|
||||
currinfo = self._do_web_request(self.sysurl, cache=False)
|
||||
return {'powerstate': str(currinfo['PowerState'].lower())}
|
||||
@@ -1403,7 +1407,7 @@ class Command(object):
|
||||
def oem(self):
|
||||
if not self._oem:
|
||||
self._oem = oem.get_oem_handler(
|
||||
self.sysinfo, self.sysurl, self.wc, self._urlcache)
|
||||
self.sysinfo, self.sysurl, self.wc, self._urlcache, self)
|
||||
self._oem.set_credentials(self.username, self.password)
|
||||
return self._oem
|
||||
|
||||
|
||||
@@ -17,8 +17,12 @@ from pyghmi.redfish.oem.lenovo import tsma
|
||||
from pyghmi.redfish.oem.lenovo import xcc
|
||||
|
||||
|
||||
def get_handler(sysinfo, sysurl, webclient, cache):
|
||||
def get_handler(sysinfo, sysurl, webclient, cache, cmd):
|
||||
leninf = sysinfo.get('Oem', {}).get('Lenovo', {})
|
||||
if not leninf:
|
||||
bmcinfo = cmd.bmcinfo
|
||||
if 'Ami' in bmcinfo.get('Oem', {}):
|
||||
return tsma.TsmHandler(sysinfo, sysurl, webclient, cache)
|
||||
if 'FrontPanelUSB' in leninf or sysinfo.get('SKU', '').startswith('7X58'):
|
||||
return xcc.OEMHandler(sysinfo, sysurl, webclient, cache)
|
||||
else:
|
||||
|
||||
@@ -20,11 +20,18 @@ OEMMAP = {
|
||||
}
|
||||
|
||||
|
||||
def get_oem_handler(sysinfo, sysurl, webclient, cache):
|
||||
def get_oem_handler(sysinfo, sysurl, webclient, cache, cmd):
|
||||
for oem in sysinfo.get('Oem', {}):
|
||||
if oem in OEMMAP:
|
||||
return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache)
|
||||
return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache,
|
||||
cmd)
|
||||
for oem in sysinfo.get('Links', {}).get('OEM', []):
|
||||
if oem in OEMMAP:
|
||||
return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache)
|
||||
return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache,
|
||||
cmd)
|
||||
bmcinfo = cmd.bmcinfo
|
||||
for oem in bmcinfo.get('Oem', {}):
|
||||
if oem in OEMMAP:
|
||||
return OEMMAP[oem].get_handler(sysinfo, sysurl, webclient, cache,
|
||||
cmd)
|
||||
return generic.OEMHandler(sysinfo, sysurl, webclient, cache)
|
||||
|
||||
Reference in New Issue
Block a user