From 77d7d373c3e8e8f4bad503544bd9f28609eeafb5 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 14 Sep 2016 15:08:03 -0400 Subject: [PATCH] Handle disconnect notification without session If session no longer exists, do not try to manipulate it's keepalives. Remove instances of calling the function where it would be redundant. Change-Id: I2011f8012175ef12ce83eb34fbf4de9650fb157e --- pyghmi/ipmi/console.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index 3efbd9b7..95e85515 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -146,7 +146,6 @@ class Console(object): def _got_payload_instance_info(self, response): if 'error' in response: self.activated = False - self.ipmi_session.unregister_keepalive(self.keepaliveid) self._print_error(response['error']) return currowner = struct.unpack( @@ -154,7 +153,6 @@ class Console(object): if currowner[0] != self.ipmi_session.sessionid: # the session is deactivated or active for something else self.activated = False - self.ipmi_session.unregister_keepalive(self.keepaliveid) self._print_error('SOL deactivated') return # ok, still here, that means session is alive, but another @@ -184,7 +182,8 @@ class Console(object): def close(self): """Shut down an SOL session, """ - self.ipmi_session.unregister_keepalive(self.keepaliveid) + if self.ipmi_session: + self.ipmi_session.unregister_keepalive(self.keepaliveid) if self.activated: try: self.ipmi_session.raw_command(netfn=6, command=0x49,