summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-08-26 19:17:28 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-08-26 19:17:28 +0000
commit36d356091d9703459149a6fc6d0840492dc31454 (patch)
treee72c5e8e18776948a60d4375e3b64fbf0142a9ba
parentadb9982c401d047de458dbd95e6d748dea063659 (diff)
downloadbcfg2-36d356091d9703459149a6fc6d0840492dc31454.tar.gz
bcfg2-36d356091d9703459149a6fc6d0840492dc31454.tar.bz2
bcfg2-36d356091d9703459149a6fc6d0840492dc31454.zip
Implement better error reporting for TCheetah
Cheetah template errors now display: NotFound: cannot find 'hostn' while searching for 'self.metadata.hostn' Failed to template /bcfg2.conf git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3645 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Plugins/TCheetah.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py
index 3eb41e834..ec31a66b9 100644
--- a/src/lib/Server/Plugins/TCheetah.py
+++ b/src/lib/Server/Plugins/TCheetah.py
@@ -1,7 +1,8 @@
'''This module implements a templating generator based on Cheetah'''
__revision__ = '$Revision$'
-import logging, lxml.etree, posixpath, re, Cheetah.Parser, Cheetah.Template
+import logging, lxml.etree, posixpath, traceback, re, sys
+import Cheetah.Template, Cheetah.Parser
import Bcfg2.Server.Plugin
logger = logging.getLogger('Bcfg2.Plugins.TCheetah')
@@ -56,7 +57,11 @@ class TemplateFile:
try:
entry.text = str(self.template)
except:
+ (a,b,c) = sys.exc_info()
+ msg = traceback.format_exception(a, b, c, limit=2)[-1][:-1]
+ logger.error(msg)
logger.error("Failed to template %s" % entry.get('name'))
+ del a, b, c
raise Bcfg2.Server.Plugin.PluginExecutionError
if hasattr(self, 'infoxml'):
mdata = {}