summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-08-26 19:48:33 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-08-26 19:48:33 +0000
commit9f50fe6087f4c21f0b6c3b7002b62d98800f938c (patch)
tree2f8076555e271b003deaabc63202cb00b8b9a342 /src
parent36d356091d9703459149a6fc6d0840492dc31454 (diff)
downloadbcfg2-9f50fe6087f4c21f0b6c3b7002b62d98800f938c.tar.gz
bcfg2-9f50fe6087f4c21f0b6c3b7002b62d98800f938c.tar.bz2
bcfg2-9f50fe6087f4c21f0b6c3b7002b62d98800f938c.zip
Add infoxml support to TGenshi
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3646 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/TGenshi.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/TGenshi.py b/src/lib/Server/Plugins/TGenshi.py
index 419c73f32..5867797e1 100644
--- a/src/lib/Server/Plugins/TGenshi.py
+++ b/src/lib/Server/Plugins/TGenshi.py
@@ -28,7 +28,11 @@ class TemplateFile:
self.template = self.loader.load(os.path.join(self.name[1:], event.filename), cls=MarkupTemplate)
except TemplateError, terror:
logger.error('Genshi template error: %s' % terror)
-
+ 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)
@@ -62,7 +66,14 @@ class TemplateFile:
except TemplateError, terror:
logger.error('Genshi template error: %s' % terror)
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 GenshiProperties(Bcfg2.Server.Plugin.SingleXMLFileBacked):
'''Class for Genshi properties'''
@@ -111,7 +122,8 @@ class TGenshi(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.xml', 'template.txt']:
+ if event.filename in ['info', 'info.xml', 'template.xml',
+ 'template.txt']:
identifier = self.handles[event.requestID][:-1]
else:
identifier = self.handles[event.requestID] + event.filename