summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2008-04-10 15:32:06 +0200
committerMartin Sivak <msivak@redhat.com>2008-04-10 15:32:06 +0200
commit0cb521d21e24df5ffcf0f4db057a9294de518f17 (patch)
treed804c7afa83c0c36eb337de34017d139b677332e /pyfirstaidkit
parent9cda69702a3bf9006e1be56eef7936119f2b6072 (diff)
downloadfirstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.tar.gz
firstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.tar.xz
firstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.zip
When plugin throws an exception during plugin discovery, ignore it (just print error message)
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/plugins.py9
-rw-r--r--pyfirstaidkit/reporting.py2
2 files changed, 7 insertions, 4 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index 33d6930..805667f 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -465,12 +465,15 @@ class PluginSystem(object):
level = PLUGINSYSTEM, origin = self)
moduleinfo = imp.find_module(m, [path])
module = imp.load_module(".".join([FirstAidKit.__name__, m]), *moduleinfo)
+ self._plugins[m] = module
+ self._reporting.debug("Module %s successfully imported with basedir %s" %
+ (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self)
+ except Exception, e:
+ self._reporting.error(message = "Module %s was NOT imported, because of %s" %
+ (m, str(e)), level = PLUGINSYSTEM, origin = self)
finally:
imp.release_lock()
- self._plugins[m] = module
- self._reporting.debug("Module %s successfully imported with basedir %s" %
- (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self)
def list(self):
"""Return the list of imported plugins"""
diff --git a/pyfirstaidkit/reporting.py b/pyfirstaidkit/reporting.py
index 1ee0e6b..1554b74 100644
--- a/pyfirstaidkit/reporting.py
+++ b/pyfirstaidkit/reporting.py
@@ -97,7 +97,7 @@ class Reports(object):
def end(self):
return self.put(None, FIRSTAIDKIT, None, END, importance = 1000)
- def error(self, message, level, origin, action):
+ def error(self, message, level, origin, action = INFO):
Logger.error(origin.name+": "+message)
return self.put(message, level, origin, action, importance = logging.ERROR)