blob: 498b496ac4fdd32229f2120a340d20e46a4af06e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import copy, lxml.etree
import Bcfg2.Server.Plugin
class PropertyFile(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:
Bcfg2.Server.Plugin.logger.error("Failed to parse %s" % self.name)
class PropDirectoryBacked(Bcfg2.Server.Plugin.DirectoryBacked):
__child__ = PropertyFile
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_data(self, _):
return copy.deepcopy(self.store.entries)
|