2
0
mirror of https://opendev.org/x/pyghmi synced 2025-02-04 21:12:47 +00:00

Validate fapm data availability before use of fapm

Some platforms do not offer fapm data, but offer a successful result
anyway.

Change-Id: I637411148a3f7e4628cc1edcd1712739438102c9
This commit is contained in:
Jarrod Johnson 2022-12-13 15:32:48 -05:00
parent f94a79a821
commit 5422e523c2

View File

@ -30,9 +30,10 @@ class EnergyManager(object):
self._usefapm = False
try:
rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0])
self.supportedmeters = ('DC Energy',)
self._usefapm = True
return
if len(rsp['data']) >= 8:
self.supportedmeters = ('DC Energy',)
self._usefapm = True
return
except pygexc.IpmiException:
pass