summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-12-13 19:26:06 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-12-13 19:26:06 +0000
commit9fba07d3f602914fd8710f9279110de3cf6b71c4 (patch)
tree85fca2ee7a79f9b990cf475f3dfff35e44fd6a15 /src/lib
parent8a2cfbd5f868a221c496908c3bae3beed1451dce (diff)
downloadbcfg2-9fba07d3f602914fd8710f9279110de3cf6b71c4.tar.gz
bcfg2-9fba07d3f602914fd8710f9279110de3cf6b71c4.tar.bz2
bcfg2-9fba07d3f602914fd8710f9279110de3cf6b71c4.zip
Fix TCheetah when properties file doesn't exist (Resolves Ticket #335)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2592 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Plugins/TCheetah.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py
index fe2640ddc..c6a603107 100644
--- a/src/lib/Server/Plugins/TCheetah.py
+++ b/src/lib/Server/Plugins/TCheetah.py
@@ -64,6 +64,11 @@ class CheetahProperties(Bcfg2.Server.Plugin.SingleXMLFileBacked):
except lxml.etree.XMLSyntaxError:
logger.error("Failed to parse properties")
+class FakeProperties:
+ '''Dummy class used when properties dont exist'''
+ def __init__(self):
+ self.properties = lxml.etree.Element("Properties")
+
class TCheetah(Bcfg2.Server.Plugin.Plugin):
'''The TCheetah generator implements a templating mechanism for configuration files'''
__name__ = 'TCheetah'
@@ -78,7 +83,12 @@ class TCheetah(Bcfg2.Server.Plugin.Plugin):
self.entries = {}
self.handles = {}
self.AddDirectoryMonitor('')
- self.properties = CheetahProperties('%s/../etc/properties.xml' % self.data, self.core.fam)
+ try:
+ self.properties = CheetahProperties('%s/../etc/properties.xml' \
+ % (self.data), self.core.fam)
+ except:
+ self.properties = FakeProperties()
+ self.logger.info("Failed to read properties file; TCheetah properties disabled")
def BuildEntry(self, entry, metadata):
'''Dispatch fetch calls to the correct object'''