summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2008-04-09 11:43:31 +0200
committerMartin Sivak <msivak@redhat.com>2008-04-09 11:43:31 +0200
commit9bf0748a3be6d462a18a67e96c743b6a687cbbdf (patch)
treefc6240aec2df86574d017b876fe560571048d30a /pyfirstaidkit
parent9963162c7aff4dfdc50368bbf1e74363184ef1d9 (diff)
downloadfirstaidkit-9bf0748a3be6d462a18a67e96c743b6a687cbbdf.tar.gz
firstaidkit-9bf0748a3be6d462a18a67e96c743b6a687cbbdf.tar.xz
firstaidkit-9bf0748a3be6d462a18a67e96c743b6a687cbbdf.zip
Report the task start/stop on correct places and report the exceptions there too
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/plugins.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py
index 825038c..33d6930 100644
--- a/pyfirstaidkit/plugins.py
+++ b/pyfirstaidkit/plugins.py
@@ -138,7 +138,9 @@ class Plugin(object):
"""call one step from plugin"""
self._result = None #mark new unfinished step
self._state = step
- return getattr(self, step)()
+ self._reporting.start(level = TASK, origin = self, message = step)
+ r = getattr(self, step)()
+ self._reporting.stop(level = TASK, origin = self, message = step)
@classmethod
def info(cls):
@@ -244,8 +246,11 @@ class Plugin(object):
try:
# Execute the function.
self.call(func)
- except: #fallback, when there is some error in plugin
+ except Exception, e: #fallback, when there is some error in plugin
+ self._reporting.exception(level = TASK, origin = self, message = func+" raised "+str(e))
+ self._reporting.stop(level = TASK, origin = self, message = func)
pass
+
return (self._state, self._result)
#
@@ -526,10 +531,8 @@ class PluginSystem(object):
p = pklass(flowName, reporting = self._reporting, dependencies = self._deps, backups = self._backups, path = plugindir)
for (step, rv) in p: #autorun all the needed steps
- self._reporting.start(level = TASK, origin = p, message = step)
Logger.info("Running step %s in plugin %s ...", step, plugin)
Logger.info("%s is current step and %s is result of that step." % (step, rv))
- self._reporting.stop(level = TASK, origin = p, message = step)
self._reporting.stop(level = PLUGIN, origin = self, message = plugin)
return True