From c28ff05b1eaadb7bb4bec1e46cee5ef9bd35d685 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 7 May 2015 10:30:52 -0400 Subject: [PATCH] Break out of FRU read if zero data returned If a BMC returns 0 data, then assume end of data has been reached. Not all implementations accurately advertise FRU size, so this is a way to detect and break out. Change-Id: I03d0393563f8527e16830098b649ae940ee7ee9e --- pyghmi/ipmi/fru.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyghmi/ipmi/fru.py b/pyghmi/ipmi/fru.py index 6b6257ee..4a4d42bf 100644 --- a/pyghmi/ipmi/fru.py +++ b/pyghmi/ipmi/fru.py @@ -172,6 +172,8 @@ class FRU(object): raise iexc.IpmiException(response['error'], response['code']) self.rawfru.extend(response['data'][1:]) offset += response['data'][0] + if response['data'][0] == 0: + break if offset + chunksize > frusize: chunksize = frusize - offset