From 5422e523c2578f654acb4de3c1759608e6b10c2c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 13 Dec 2022 15:32:48 -0500 Subject: [PATCH] Validate fapm data availability before use of fapm Some platforms do not offer fapm data, but offer a successful result anyway. Change-Id: I637411148a3f7e4628cc1edcd1712739438102c9 --- pyghmi/ipmi/oem/lenovo/energy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/energy.py b/pyghmi/ipmi/oem/lenovo/energy.py index 93b627da..746239b9 100644 --- a/pyghmi/ipmi/oem/lenovo/energy.py +++ b/pyghmi/ipmi/oem/lenovo/energy.py @@ -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