prelude-correlator/master: Handle plugin loading error gracefully

[email protected] Tue, 15 Sep 2009 08:47:17 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 1b69bef64601b8fdb2b8714afc674dd505fa30a0
Author: Yoann Vandoorselaere <[email protected]>
Date:   Tue Sep 15 08:43:36 2009 +0200

    Handle plugin loading error gracefully
    
    Emit a warning if plugin loading trigger an exception, but continue
    loading the system.


========================================

 PreludeCorrelator/pluginmanager.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

========================================

diff --git a/PreludeCorrelator/pluginmanager.py b/PreludeCorrelator/pluginmanager.py
index fe6131f..56d1975 100644
--- a/PreludeCorrelator/pluginmanager.py
+++ b/PreludeCorrelator/pluginmanager.py
@@ -66,7 +66,12 @@ class PluginManager:
         self.__instances = []
 
         for entrypoint in pkg_resources.iter_entry_points(self.__ENTRYPOINT):
-            plugin_class = entrypoint.load()
+            try:
+                plugin_class = entrypoint.load()
+            except Exception, e:
+                env.logger.warning("%s: %s" % (entrypoint, e))
+                continue
+
             pname = plugin_class.__name__
 
             if env.config.getAsBool(pname, "disable", default=False) is True:
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog