diff options
Diffstat (limited to 'src/lib/Server/Plugins/Properties.py')
-rw-r--r-- | src/lib/Server/Plugins/Properties.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/Server/Plugins/Properties.py b/src/lib/Server/Plugins/Properties.py new file mode 100644 index 000000000..61e80bfe3 --- /dev/null +++ b/src/lib/Server/Plugins/Properties.py @@ -0,0 +1,30 @@ +import copy, lxml.etree +import Bcfg2.Server.Plugin + +class Properties(Bcfg2.Server.Plugin.XMLFileBacked): + '''Class for properties files''' + def Index(self): + '''Build data into an xml object''' + try: + self.data = lxml.etree.XML(self.data) + except lxml.etree.XMLSyntaxError: + logger.error("Failed to parse %s" % self.name) + +class PropDirectoryBacked(Bcfg2.Server.Plugin.DirectoryBacked): + __child__ = Properties + +class Properties(Bcfg2.Server.Plugin.Plugin, + Bcfg2.Server.Plugin.Connector): + '''The properties plugin maps property files into client metadata instances''' + name = 'Properties' + version = '$Revision: $' + experimental = True + + + def __init__(self, core, datastore): + Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) + Bcfg2.Server.Plugin.Connector.__init__(self) + self.store = PropDirectoryBacked(self.data, core.fam) + + def get_additional_metadata(self, _): + return ((), copy.deepcopy(self.store.entries)) |