2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-28 20:07:42 +00:00

Handle custom keepalive modifications on the fly

It is possible for activity under 'raw_command' to modify custom
keepalive registry.  Tolerate the structure changing in the loop gracefully.

Change-Id: I99c99b52718dff518c303819e7a24085cc6fb97a
This commit is contained in:
Jarrod Johnon 2014-09-16 09:46:40 -04:00
parent eace546448
commit 2d5eebebd8

View File

@ -1007,7 +1007,15 @@ class Session(object):
else:
kaids = list(self._customkeepalives.keys())
for keepalive in kaids:
cmd, callback = self._customkeepalives[keepalive]
try:
cmd, callback = self._customkeepalives[keepalive]
except TypeError:
# raw_command made customkeepalives None
break
except KeyError:
# raw command ultimately caused a keepalive to
# deregister
continue
callback(self.raw_command(**cmd))
except exc.IpmiException:
self._mark_broken()