summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-04-12 12:53:32 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-05-04 11:11:58 -0400
commitddff6db72976793db29de31f082a6e6fa3814ac5 (patch)
tree887a10e6e6486170ebccb9f733c1b31baf915eef
parent98563b90b2dbaa0dae5f62f6d58c4663fb537ddf (diff)
downloadbcfg2-ddff6db72976793db29de31f082a6e6fa3814ac5.tar.gz
bcfg2-ddff6db72976793db29de31f082a6e6fa3814ac5.tar.bz2
bcfg2-ddff6db72976793db29de31f082a6e6fa3814ac5.zip
improved error reporting in a few places
-rw-r--r--src/lib/Server/Core.py6
-rw-r--r--src/lib/Server/Plugin.py2
-rw-r--r--src/lib/Server/Plugins/TGenshi.py6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py
index 82072a538..8f02e0a40 100644
--- a/src/lib/Server/Core.py
+++ b/src/lib/Server/Core.py
@@ -7,6 +7,8 @@ import select
import sys
import threading
import time
+from traceback import format_exc
+
try:
import lxml.etree
except ImportError:
@@ -240,12 +242,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/Server/Plugin.py b/src/lib/Server/Plugin.py
index 692aa8a81..d882c475f 100644
--- a/src/lib/Server/Plugin.py
+++ b/src/lib/Server/Plugin.py
@@ -847,7 +847,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/Server/Plugins/TGenshi.py b/src/lib/Server/Plugins/TGenshi.py
index bc5e00400..072f5cd7b 100644
--- a/src/lib/Server/Plugins/TGenshi.py
+++ b/src/lib/Server/Plugins/TGenshi.py
@@ -115,12 +115,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