2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

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
This commit is contained in:
Jarrod Johnson 2016-05-02 10:16:08 -04:00
parent 7b59b7759b
commit 3fe1b5f60f

View File

@ -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)