This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit e25ed006647ff08540ccbe37353d4224695608cb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 17 16:15:03 2015 +0200 handled exceptions on module loader + print traceback + bug fix on full detection --- app/module_loader.py | 26 ++++++++++++++++++++------ app/mum.py | 7 +++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/app/module_loader.py b/app/module_loader.py index 57bc377..eb95f05 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -16,6 +16,7 @@ import re import pkgutil import sys import os +import traceback class ModuleLoader: @@ -165,7 +166,8 @@ class ModuleLoader: self.compatible_os_list.append(os) self.loaded_mod_detect[mod_name] = infos_mod except AttributeError: - print "Error : internal detection module " + mod_name + " could not have been loaded. " + print "Error : internal detection module " + mod_name + " could not have been loaded. Traceback:" + print traceback.format_exc() def run_all_detection_modules(self, addr_host): """ @@ -174,6 +176,7 @@ class ModuleLoader: """ db = self.get_db() conf_conn = self.db.get_conf_conn(addr_host) + success_detection = False for mod_name in self.loaded_mod_detect: for i in range(len(conf_conn)): if self.loaded_mod_detect[mod_name]['compatible_conn'] == conf_conn[i]['conn_mod_name']: @@ -181,10 +184,15 @@ class ModuleLoader: conn_inst = self.create_connection(addr_host, conf_conn[i]) getattr(self.loaded_mod_detect[mod_name]['imported'], 'run_detection')(conn_inst, db) + success_detection = True except modules.ModuleNotCompatibleException.ModuleNotCompatibleException as mnce: print mnce.__str__() except modules.CommandNotFoundException.CommandNotFoundException as cnfe: print cnfe.__str__() + except Exception: + print "An unexpected error occured during the full detection of " + addr_host + ". Traceback:" + print traceback.format_exc() + return success_detection def load_all_monitoring_modules(self): """ @@ -213,7 +221,8 @@ class ModuleLoader: list(set(self.loaded_mod_moni[part]['compatible_conn'])) all_internal_mod[mod_name] = part except AttributeError: - print "Error : internal monitoring module " + mod_name + " could not have been loaded. " + print "Error : internal monitoring module " + mod_name + " could not have been loaded. Traceback:" + print traceback.format_exc() # Now for external modules: if self.conf['external_modules_location'] is not None: @@ -247,7 +256,8 @@ class ModuleLoader: self.loaded_mod_moni[part]['compatible_conn'] = \ list(set(self.loaded_mod_moni[part]['compatible_conn'])) except AttributeError: - print "Error : external monitoring module " + mod_name + " could not have been loaded. " + print "Error : external monitoring module " + mod_name + " could not have been loaded. Traceback:" + print traceback.format_exc() def run_one_monitoring_module(self, part_name, addr_host, conn, db): """ @@ -299,7 +309,8 @@ class ModuleLoader: self.db.config_mod_activation(dict_deactivation_request) except Exception: print "Monitoring module " + part_name + " have been disabled on " + addr_host + \ - " because of an unexpected error." + " because of an unexpected error. Traceback:" + print traceback.format_exc() process_monitoring.remove_to_waiting_list(addr_host, part_name) dict_deactivation_request = {} dict_deactivation_request['addr_host'] = addr_host @@ -377,7 +388,8 @@ class ModuleLoader: infos_mod['known_port'] = getattr(mod_inst, 'get_known_port')() self.loaded_mod_conn[mod_name] = infos_mod except AttributeError: - print "Error : internal connection module " + mod_name + " could not have been loaded. " + print "Error : internal connection module " + mod_name + " could not have been loaded. Traceback:" + print traceback.format_exc() def get_conection_modules_list(self): """ @@ -432,7 +444,8 @@ class ModuleLoader: infos_mod['class_name'] = getattr(mod_inst, 'get_name')() self.loaded_mod_notif[mod_name] = infos_mod except AttributeError: - print "Error : internal notification module " + mod_name + " could not have been loaded. " + print "Error : internal notification module " + mod_name + " could not have been loaded. Traceback:" + print traceback.format_exc() def get_info_mod_notification(self): """ @@ -474,6 +487,7 @@ class ModuleLoader: mod_inst.notify() except KeyError: print 'Missing setting for notification module ' + notif_mod + print traceback.format_exc() def update_global_conf(self): """ diff --git a/app/mum.py b/app/mum.py index 016306f..dc79af3 100755 --- a/app/mum.py +++ b/app/mum.py @@ -131,8 +131,11 @@ def receive(ws): ml.create_empty_host(msg["CREATE_EMPTY_HOST"]) ws.send(json.dumps({"SUCCESS_MODULE": "Creation of new host"})) elif code == "LAUNCH_FULL_DETECTION": # asked from hostpage - ml.run_all_detection_modules(msg["LAUNCH_FULL_DETECTION"]) - ws.send(json.dumps({"SUCCESS_MODULE": "Full detection"})) + suceess_detection = ml.run_all_detection_modules(msg["LAUNCH_FULL_DETECTION"]) + if suceess_detection: + ws.send(json.dumps({"SUCCESS_MODULE": "Full detection"})) + else: + ws.send(json.dumps({"ERROR": "Full detection has failed (is SSH well configured?)"})) elif code == "GET_HOSTS": # asked from head controller db = ml.get_db() ws.send(json.dumps({"RES_GET_HOSTS": db.get_hosts()})) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.