From 721096b114e9d426384eb77b7da11c9f40511732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Ba=C5=9Faran?= Date: Wed, 30 Mar 2016 10:51:32 +0300 Subject: [PATCH] Moved register event types to enumaration --- opt/ahenk/base/execution/ExecutionManager.py | 12 ++++++------ opt/ahenk/base/model/MessageType.py | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/opt/ahenk/base/execution/ExecutionManager.py b/opt/ahenk/base/execution/ExecutionManager.py index a53f25a..0b74028 100644 --- a/opt/ahenk/base/execution/ExecutionManager.py +++ b/opt/ahenk/base/execution/ExecutionManager.py @@ -12,6 +12,7 @@ import subprocess from base.Scope import Scope from base.model.Policy import Policy from base.model.Task import Task +from base.model.MessageType import MessageType class ExecutionManager(object): @@ -28,12 +29,11 @@ class ExecutionManager(object): self.logger = scope.getLogger() self.db_service = scope.getDbService() - # TODO move this event names to enumeration - self.event_manager.register_event('EXECUTE_SCRIPT', self.execute_script) - self.event_manager.register_event('REQUEST_FILE', self.request_file) - self.event_manager.register_event('MOVE_FILE', self.move_file) - self.event_manager.register_event('EXECUTE_TASK', self.execute_task) - self.event_manager.register_event('EXECUTE_POLICY', self.execute_policy) + self.event_manager.register_event(MessageType.EXECUTE_SCRIPT, self.execute_script) + self.event_manager.register_event(MessageType.REQUEST_FILE, self.request_file) + self.event_manager.register_event(MessageType.MOVE_FILE, self.move_file) + self.event_manager.register_event(MessageType.EXECUTE_TASK, self.execute_task) + self.event_manager.register_event(MessageType.EXECUTE_POLICY, self.execute_policy) def execute_policy(self, arg): diff --git a/opt/ahenk/base/model/MessageType.py b/opt/ahenk/base/model/MessageType.py index 49e223e..eb6abf9 100644 --- a/opt/ahenk/base/model/MessageType.py +++ b/opt/ahenk/base/model/MessageType.py @@ -12,3 +12,8 @@ class MessageType(Enum): TASK_WARNING = 'TASK_WARNING' POLICY_RECEIVED = 'POLICY_RECEIVED' POLICY_PROCESSED = 'POLICY_PROCESSED' + EXECUTE_POLICY = 'EXECUTE_POLICY' + EXECUTE_TASK = 'EXECUTE_TASK' + MOVE_FILE = 'MOVE_FILE' + REQUEST_FILE = 'REQUEST_FILE' + EXECUTE_SCRIPT = 'EXECUTE_SCRIPT'