2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Fix reading the identify state and the description over redfish

get_identify indexed the sysinfo method object rather than awaiting it, so
reading the identify state raised a KeyError naming a bound method on every
redfish system. Read the indicator from the chassis that owns the physical
led, since some implementations leave the copy on the system stale, and say
plainly when a platform does not report one.

The generic get_description took no fishclient while every other handler and
the caller pass one, so the description resource raised a TypeError on any
non Lenovo bmc.
This commit is contained in:
Markus Hilger
2026-08-13 18:07:21 +02:00
parent 8d519b57a6
commit 6d36e803b1
2 changed files with 20 additions and 4 deletions
+18 -2
View File
@@ -873,8 +873,24 @@ class Command(object):
}
async def get_identify(self):
await self.sysinfo()
ledstate = self.sysinfo
sysinfo = await self.sysinfo()
ledstate = sysinfo.get('IndicatorLED', None)
# The physical indicator belongs to the chassis, and some
# implementations do not refresh the system copy of it when it
# changes, so prefer a chassis that describes this system alone.
for chassis in sysinfo.get('Links', {}).get('Chassis', []):
chassisinfo = await self._do_web_request(chassis['@odata.id'])
if len(chassisinfo.get('Links', {}).get('ComputerSystems', [])) > 1:
continue
if chassisinfo.get('IndicatorLED', None) in self._idstatemap:
ledstate = chassisinfo['IndicatorLED']
break
if ledstate is None:
raise exc.UnsupportedFunctionality(
'Indicator LED state is not reported by this platform')
if ledstate not in self._idstatemap:
raise exc.PyghmiException(
'Unrecognized indicator LED state "{0}"'.format(ledstate))
return {'identifystate': self._idstatemap[ledstate]}
async def get_health(self, verbose=True):
@@ -990,8 +990,8 @@ class OEMHandler(object):
async def detach_remote_media(self):
return None
async def get_description(self):
sysinfo = await self.sysinfo()
async def get_description(self, fishclient):
sysinfo = await fishclient.sysinfo()
for chassis in sysinfo.get('Links', {}).get('Chassis', []):
chassisurl = chassis['@odata.id']
chassisinfo = await self._do_web_request(chassisurl)