diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-08 15:09:54 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-08 15:36:02 -0400 |
commit | c35347887bb3d452d6104b13308d853b3da44b68 (patch) | |
tree | 569d5a6d94bfbd598a645c5511818d94b384acb4 /src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py | |
parent | 16b7ac3cb7f9a49e6b7985059c3d08e984cf468c (diff) | |
download | bcfg2-c35347887bb3d452d6104b13308d853b3da44b68.tar.gz bcfg2-c35347887bb3d452d6104b13308d853b3da44b68.tar.bz2 bcfg2-c35347887bb3d452d6104b13308d853b3da44b68.zip |
modularized Cfg
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py new file mode 100644 index 000000000..35aaa0442 --- /dev/null +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgInfoXML.py @@ -0,0 +1,24 @@ +import logging +import Bcfg2.Server.Plugin +from Bcfg2.Server.Plugins.Cfg import CfgInfo + +logger = logging.getLogger('Bcfg2.Plugins.Cfg') + +class CfgInfoXML(CfgInfo): + names = ['info.xml'] + + def __init__(self, path): + CfgInfo.__init__(self, path) + self.infoxml = Bcfg2.Server.Plugin.InfoXML(path, noprio=True) + + def bind_info_to_entry(self, entry, metadata): + mdata = dict() + self.infoxml.pnode.Match(metadata, mdata, entry=entry) + if 'Info' not in mdata: + logger.error("Failed to set metadata for file %s" % + entry.get('name')) + raise PluginExecutionError + self._set_info(entry, mdata['Info'][None]) + + def handle_event(self, event): + self.infoxml.HandleEvent() |