summaryrefslogtreecommitdiffstats
path: root/src/lib/Server
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-09-15 02:11:37 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-09-15 02:11:37 +0000
commita6781fdff0e1ede8ed3bed5a2886127c9a42b408 (patch)
tree095b0205a596e14699001699ee02fb635f286846 /src/lib/Server
parent1f8aa9dc8bdad04814fe864c5d30d51ec904a9b0 (diff)
downloadbcfg2-a6781fdff0e1ede8ed3bed5a2886127c9a42b408.tar.gz
bcfg2-a6781fdff0e1ede8ed3bed5a2886127c9a42b408.tar.bz2
bcfg2-a6781fdff0e1ede8ed3bed5a2886127c9a42b408.zip
Implement useful error handling for template parse failures
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2254 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r--src/lib/Server/Plugins/TCheetah.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py
index 7032e09fa..0ef453a9e 100644
--- a/src/lib/Server/Plugins/TCheetah.py
+++ b/src/lib/Server/Plugins/TCheetah.py
@@ -1,7 +1,7 @@
'''This module implements a templating generator based on Cheetah'''
__revision__ = '$Revision$'
-import logging, lxml.etree, posixpath, re, Cheetah.Template
+import logging, lxml.etree, posixpath, re, Cheetah.Parser, Cheetah.Template
import Bcfg2.Server.Plugin
logger = logging.getLogger('Bcfg2.Plugins.TCheetah')
@@ -19,8 +19,12 @@ class TemplateFile:
def HandleEvent(self, event):
'''Handle all fs events for this template'''
if event.filename == 'template':
- self.template = Cheetah.Template.Template(open(self.name).read())
- self.template.properties = self.properties.properties
+ try:
+ self.template = Cheetah.Template.Template(open(self.name).read())
+ self.template.properties = self.properties.properties
+ except Cheetah.Parser.ParseError, perror:
+ logger.error("Cheetah parse error for file %s" % (self.name))
+ logger.error(perror.report())
elif event.filename == 'info':
for line in open(self.name[:-8] + '/info').readlines():
match = info.match(line)