From 3fe1b5f60f7ab0c0431441f30beeb0e145a1c08c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 2 May 2016 10:16:08 -0400 Subject: [PATCH] Cope with empty agentless fields Some adapters present empty agentless fields. For such scenarios, skip enumerating the key. This avoids date parsing errors, among other things. Change-Id: I3df5f1dd320aa2e915760b6d2cae0f04ec5e09c6 --- pyghmi/ipmi/oem/lenovo/imm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 98c5ebfe..95c4252d 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -123,8 +123,11 @@ def fetch_adapter_firmware(ipmicmd, certverify): continue donenames.add(fname) bdata = {} - bdata['version'] = firm['versionStr'] - if 'releaseDate' in firm and firm['releaseDate'] != 'N/A': + if 'versionStr' in firm and firm['versionStr']: + bdata['version'] = firm['versionStr'] + if ('releaseDate' in firm and + firm['releaseDate'] and + firm['releaseDate'] != 'N/A'): bdata['date'] = datetime.strptime(firm['releaseDate'], '%m/%d/%Y') yield ('{0} {1}'.format(aname, fname), bdata)