From ed220d6ebdf731d3fb5683a7c669f7deaf5ed7d4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 31 Jan 2014 15:15:23 -0500 Subject: [PATCH] Fix exception if login times out If a client attempts connection to a BMC that is not there, unusual KeyError would get thrown. Correct this by only attempting to deregister the element if it is registered. Change-Id: I3febb92ae8bc40c2847758797f179e85d58d97b1 --- pyghmi/ipmi/private/session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 0e83a4f9..6321d857 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -256,7 +256,8 @@ class Session(object): # This allows constructor to create a new, functional object to # replace this one for sockaddr in self.allsockaddrs: - del Session.bmc_handlers[sockaddr] + if sockaddr in Session.bmc_handlers: + del Session.bmc_handlers[sockaddr] if self.sol_handler: self.sol_handler({'error': 'Session Disconnected'})