From d94bc37d48d4eefdceafef49187207b16d7dd813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 30 Jul 2018 09:25:19 +0200 Subject: [PATCH] Add event logging to FSMAware --- lib/tfw/networking/fsm_aware.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/tfw/networking/fsm_aware.py b/lib/tfw/networking/fsm_aware.py index e666d8c..cb2b287 100644 --- a/lib/tfw/networking/fsm_aware.py +++ b/lib/tfw/networking/fsm_aware.py @@ -16,7 +16,7 @@ class FSMAware: def __init__(self): self.fsm_state = None self.fsm_in_accepted_state = False - self.fsm_last_update = None + self.fsm_event_log = [] self._auth_key = KeyManager().auth_key def update_fsm_data(self, message): @@ -27,12 +27,13 @@ class FSMAware: def _handle_fsm_update(self, message): try: - new_state = message['data']['current_state'] + update_data = message['data'] + new_state = update_data['current_state'] if self.fsm_state != new_state: - self.handle_fsm_step(**(message['data'])) + self.handle_fsm_step(**update_data) self.fsm_state = new_state - self.fsm_in_accepted_state = message['data']['in_accepted_state'] - self.fsm_last_update = message['data'] + self.fsm_in_accepted_state = update_data['in_accepted_state'] + self.fsm_event_log.append(update_data) except KeyError: LOG.error('Invalid fsm_update message received!')