mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:01:33 +00:00
Implement trigger history in FSMBase
This commit is contained in:
parent
d98ce58651
commit
77f14df17b
@ -24,6 +24,7 @@ class FSMBase(Machine, CallbackMixin):
|
||||
def __init__(self, initial=None, accepted_states=None):
|
||||
self.accepted_states = accepted_states or [self.states[-1]]
|
||||
self.trigger_predicates = defaultdict(list)
|
||||
self.trigger_history = []
|
||||
|
||||
Machine.__init__(
|
||||
self,
|
||||
@ -61,5 +62,6 @@ class FSMBase(Machine, CallbackMixin):
|
||||
if all(predicate_results):
|
||||
try:
|
||||
self.trigger(trigger)
|
||||
self.trigger_history.append(trigger)
|
||||
except (AttributeError, MachineError):
|
||||
LOG.debug('FSM failed to execute nonexistent trigger: "%s"', trigger)
|
||||
|
Loading…
Reference in New Issue
Block a user