2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 07:43:39 +00:00

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
This commit is contained in:
Jarrod Johnson
2022-05-11 11:09:33 -04:00
parent 45dc3bad83
commit 65c8f4ec32

View File

@@ -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):