diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-04-12 12:53:32 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-04-13 11:57:13 -0400 |
commit | dc4da95bdc0172effba7551946ef0958c029cc42 (patch) | |
tree | 9a7a136678276d37527d90de071deea796ada745 | |
parent | e89e879c2089a95678120e07a0e0f7eddd2d70bb (diff) | |
download | bcfg2-dc4da95bdc0172effba7551946ef0958c029cc42.tar.gz bcfg2-dc4da95bdc0172effba7551946ef0958c029cc42.tar.bz2 bcfg2-dc4da95bdc0172effba7551946ef0958c029cc42.zip |
improved error reporting in a few places
-rw-r--r-- | src/lib/Bcfg2/Server/Core.py | 6 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin.py | 2 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/TGenshi.py | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index 3647ee622..112c484b1 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -6,6 +6,8 @@ import select import sys import threading import time +from traceback import format_exc + try: import lxml.etree except ImportError: @@ -239,12 +241,12 @@ class Core(Component): self.Bind(entry, metadata) except PluginExecutionError, exc: if 'failure' not in entry.attrib: - entry.set('failure', 'bind error: %s' % exc) + entry.set('failure', 'bind error: %s' % format_exc()) logger.error("Failed to bind entry: %s %s" % \ (entry.tag, entry.get('name'))) except Exception, exc: if 'failure' not in entry.attrib: - entry.set('failure', 'bind error: %s' % exc) + entry.set('failure', 'bind error: %s' % format_exc()) logger.error("Unexpected failure in BindStructure: %s %s" \ % (entry.tag, entry.get('name')), exc_info=1) diff --git a/src/lib/Bcfg2/Server/Plugin.py b/src/lib/Bcfg2/Server/Plugin.py index d284ffe35..11e6c5c20 100644 --- a/src/lib/Bcfg2/Server/Plugin.py +++ b/src/lib/Bcfg2/Server/Plugin.py @@ -859,7 +859,7 @@ class PrioDir(Plugin, Generator, XMLDirectoryBacked): self._matches(entry, metadata, src.cache[1][entry.tag]))] if len(matching) == 0: - raise PluginExecutionError + raise PluginExecutionError('No matching source for entry when retrieving attributes for %s(%s)' % (entry.tag, entry.attrib.get('name'))) elif len(matching) == 1: index = 0 else: diff --git a/src/lib/Bcfg2/Server/Plugins/TGenshi.py b/src/lib/Bcfg2/Server/Plugins/TGenshi.py index 3ba0f4272..45c87fb6c 100644 --- a/src/lib/Bcfg2/Server/Plugins/TGenshi.py +++ b/src/lib/Bcfg2/Server/Plugins/TGenshi.py @@ -114,12 +114,10 @@ class TemplateFile: if entry.text == '': entry.set('empty', 'true') except TemplateError: - terror = sys.exc_info()[1] - logger.error('Genshi template error: %s' % terror) + logger.exception('Genshi template error') raise Bcfg2.Server.Plugin.PluginExecutionError except AttributeError: - err = sys.exc_info()[1] - logger.error('Genshi template loading error: %s' % err) + logger.exception('Genshi template loading error') raise Bcfg2.Server.Plugin.PluginExecutionError |