From ee4cd47588f4c13a469e2bfce9981d2462679325 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Wed, 23 Jul 2014 10:18:45 +0100 Subject: [PATCH] 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 --- pyghmi/ipmi/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index ea7f3f3c..1d0b4216 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -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: