mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 00:21:32 +00:00
Add 'in_accepted_state' to fsm_update messages
This commit is contained in:
parent
e1e0acb3b8
commit
96b4e314a9
@ -59,8 +59,10 @@ class FSMUpdater:
|
|||||||
for trigger in self.fsm.get_triggers(self.fsm.state)
|
for trigger in self.fsm.get_triggers(self.fsm.state)
|
||||||
]
|
]
|
||||||
last_trigger = self.fsm.trigger_history[-1] if self.fsm.trigger_history else None
|
last_trigger = self.fsm.trigger_history[-1] if self.fsm.trigger_history else None
|
||||||
|
in_accepted_state = state in self.fsm.accepted_states
|
||||||
return {
|
return {
|
||||||
'current_state': state,
|
'current_state': state,
|
||||||
'valid_transitions': valid_transitions,
|
'valid_transitions': valid_transitions,
|
||||||
'last_trigger': last_trigger
|
'last_trigger': last_trigger,
|
||||||
|
'in_accepted_state': in_accepted_state
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ class FSMAwareEventHandler(EventHandlerBase, ABC):
|
|||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.subscribe('fsm_update')
|
self.subscribe('fsm_update')
|
||||||
self.fsm_state = None
|
self.fsm_state = None
|
||||||
|
self.in_accepted_state = False
|
||||||
self._auth_key = KeyManager().auth_key
|
self._auth_key = KeyManager().auth_key
|
||||||
|
|
||||||
def dispatch_handling(self, message):
|
def dispatch_handling(self, message):
|
||||||
@ -132,6 +133,7 @@ class FSMAwareEventHandler(EventHandlerBase, ABC):
|
|||||||
if self.fsm_state != new_state:
|
if self.fsm_state != new_state:
|
||||||
self.handle_fsm_step(self.fsm_state, new_state, trigger)
|
self.handle_fsm_step(self.fsm_state, new_state, trigger)
|
||||||
self.fsm_state = new_state
|
self.fsm_state = new_state
|
||||||
|
self.in_accepted_state = message['data']['in_accepted_state']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
LOG.error('Invalid fsm_update message received!')
|
LOG.error('Invalid fsm_update message received!')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user