2
0
mirror of https://opendev.org/x/pyghmi synced 2026-03-30 23:03:31 +00:00

Use get() to avoid KeyError on get_bootdev()

The method get() returns a value for the given key. If key is not
available then returns default value None. I think that was the
intention of the initial code.

Change-Id: I974258822d54f7ac09bc4197eb4ec249784012e7
This commit is contained in:
Lucas Alvares Gomes
2014-07-23 10:18:45 +01:00
parent 8740687e0f
commit ee4cd47588

View File

@@ -145,7 +145,7 @@ class Command(object):
return {'bootdev': 'default'}
else: # will consult data2 of the boot flags parameter for the data
bootnum = (response['data'][3] & 0b111100) >> 2
bootdev = boot_devices[bootnum]
bootdev = boot_devices.get(bootnum)
if bootdev:
return {'bootdev': bootdev}
else: