summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-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