diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-08-26 18:57:22 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-08-26 18:57:22 +0000 |
commit | adb9982c401d047de458dbd95e6d748dea063659 (patch) | |
tree | 69ab490a160bb7617b1000a4ae245d598fa96f4d | |
parent | d6163ab0982d6ea065634c7d3fc46916260411c6 (diff) | |
download | bcfg2-adb9982c401d047de458dbd95e6d748dea063659.tar.gz bcfg2-adb9982c401d047de458dbd95e6d748dea063659.tar.bz2 bcfg2-adb9982c401d047de458dbd95e6d748dea063659.zip |
Implement infoxml support for TCheetah
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3644 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Server/Plugins/TCheetah.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py index fa52d8811..3eb41e834 100644 --- a/src/lib/Server/Plugins/TCheetah.py +++ b/src/lib/Server/Plugins/TCheetah.py @@ -26,6 +26,11 @@ class TemplateFile: except Cheetah.Parser.ParseError, perror: logger.error("Cheetah parse error for file %s" % (self.name)) logger.error(perror.report()) + elif event.filename == 'info.xml': + if not hasattr(self, 'infoxml'): + fpath = self.name + '/info.xml' + self.infoxml = Bcfg2.Server.Plugin.XMLSrc(fpath, True) + self.infoxml.HandleEvent(event) elif event.filename == 'info': for line in open(self.name + '/info').readlines(): match = info.match(line) @@ -53,7 +58,14 @@ class TemplateFile: except: logger.error("Failed to template %s" % entry.get('name')) raise Bcfg2.Server.Plugin.PluginExecutionError - [entry.attrib.__setitem__(key, value) for (key, value) in self.metadata.iteritems()] + if hasattr(self, 'infoxml'): + mdata = {} + self.infoxml.pnode.Match(metadata, mdata) + [entry.attrib.__setitem__(key, value) \ + for (key, value) in mdata['Info'][None].iteritems()] + else: + [entry.attrib.__setitem__(key, value) \ + for (key, value) in self.metadata.iteritems()] class CheetahProperties(Bcfg2.Server.Plugin.SingleXMLFileBacked): '''Class for Cheetah properties''' @@ -102,7 +114,7 @@ class TCheetah(Bcfg2.Server.Plugin.Plugin): if event.filename[0] == '/': return epath = "".join([self.data, self.handles[event.requestID], event.filename]) - if event.filename in ['info', 'template']: + if event.filename in ['info', 'template', 'info.xml']: identifier = self.handles[event.requestID][:-1] else: identifier = self.handles[event.requestID] + event.filename |