From 78b8d6d8707cc1f623295f72dd15137dfc957c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Mon, 14 Mar 2016 12:05:12 +0200 Subject: [PATCH] logger fixes --- opt/ahenk/base/execution/ExecutionManager.py | 3 ++- opt/ahenk/base/registration/Registration.py | 18 ++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/opt/ahenk/base/execution/ExecutionManager.py b/opt/ahenk/base/execution/ExecutionManager.py index 6608458..caf87ee 100644 --- a/opt/ahenk/base/execution/ExecutionManager.py +++ b/opt/ahenk/base/execution/ExecutionManager.py @@ -16,6 +16,7 @@ class ExecutionManager(object): scope = Scope.getInstance() self.config_manager = scope.getConfigurationManager() self.event_manager = scope.getEventManager() + self.logger=scope.getLogger() self.event_manager.register_event('EXECUTE_TASK',self.execute_task) self.event_manager.register_event('EXECUTE_SCRIPT',self.execute_script) @@ -32,7 +33,7 @@ class ExecutionManager(object): #msg_id =str(j['id']).lower() target_file_path =str(j['filepath']).lower() file_name =str(j['filename']).lower() - self.logger.debug('[ExecutionManager] %s will be moved to %s' % file_name,target_file_path) + self.logger.debug('[ExecutionManager] '+file_name+' will be moved to '+target_file_path) shutil.move(default_file_path+file_name,target_file_path+file_name) def execute_script(self,arg): diff --git a/opt/ahenk/base/registration/Registration.py b/opt/ahenk/base/registration/Registration.py index 6b2cac5..fcc8b5e 100644 --- a/opt/ahenk/base/registration/Registration.py +++ b/opt/ahenk/base/registration/Registration.py @@ -31,12 +31,12 @@ class Registration(): def registration_request(self): self.logger.debug('[Registration] Requesting registration') - message_sender=MessageSender(self.get_registration_request_message(),None) + message_sender=MessageSender(self.message_manager.registration_msg(),None) message_sender.connect_to_server() def ldap_registration_request(self): self.logger.debug('[Registration] Requesting LDAP registration') - message_sender=MessageSender(self.get_ldap_registration_request_message(),None) + message_sender=MessageSender(self.message_manager.ldap_registration_msg(),None) message_sender.connect_to_server() def confirm_registration(self,reg_reply): @@ -84,20 +84,6 @@ class Registration(): else: return False - def get_registration_request_message(self): - if self.conf_manager.has_section('REGISTRATION'): - return self.message_manager.registration_msg() - else: - self.logger.error('[Registration] Registration section not found while trying to registration request') - return None - - def get_ldap_registration_request_message(self): - if self.conf_manager.has_section('REGISTRATION'): - return self.message_manager.ldap_registration_msg() - else: - self.logger.error('[Registration] Registration section not found while trying to ldap registration request') - return None - def register(self,uuid_depend_mac): if self.conf_manager.has_section('REGISTRATION'): self.logger.info('[Registration] Registration section is already created')