From 65c8f4ec320b7988b4adfba81d19feefa3444b24 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 11 May 2022 11:09:33 -0400 Subject: [PATCH] Execute internal cleanup on logout If not logged in, continue to skip trying to reach BMC, but do fire off internal cleanup. This is technically an oversight, made worse by the recent changes to 'unlog' as part of retry. Change-Id: I0825c1f77decb81694f897b904a19a2f59587055 --- pyghmi/ipmi/private/session.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 75549d7c..db78da29 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -1827,18 +1827,19 @@ class Session(object): Session.waiting_sessions[self]['timeout'] = self.expiration def logout(self, sessionok=True): - if not self.logged: - return {'success': True} + if self.cleaningup: self.nowait = True - if self.sol_handler: - self.raw_command(netfn=6, command=0x49, data=(1, 1, 0, 0, 0, 0), - retry=sessionok) - self.raw_command(command=0x3c, - netfn=6, - data=struct.unpack("4B", - struct.pack("I", self.sessionid)), - retry=False) + if self.logged: + if self.sol_handler: + self.raw_command( + netfn=6, command=0x49, data=(1, 1, 0, 0, 0, 0), + retry=sessionok) + self.raw_command( + command=0x3c, netfn=6, + data=struct.unpack( + "4B", struct.pack("I", self.sessionid)), + retry=False) # stop trying for a keepalive, self.lastpayload = None with util.protect(KEEPALIVE_SESSIONS):