From a9388f7859586d5d98e815efdcf8d6a85b973bef Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 5 Jan 2009 03:24:50 +0000 Subject: This patch is stage 1 of the plugin capabilities rework - define new plugin base classes - switch Plugin.__name__ => Plugin.name git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5004 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/Base.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/lib/Server/Plugins/Base.py') diff --git a/src/lib/Server/Plugins/Base.py b/src/lib/Server/Plugins/Base.py index 8cd1e4fa8..223e4de43 100644 --- a/src/lib/Server/Plugins/Base.py +++ b/src/lib/Server/Plugins/Base.py @@ -5,10 +5,12 @@ import Bcfg2.Server.Plugin import copy import lxml.etree -class Base(Bcfg2.Server.Plugin.StructurePlugin, +class Base(Bcfg2.Server.Plugin.Plugin, + Bcfg2.Server.Plugin.Structure, Bcfg2.Server.Plugin.XMLDirectoryBacked): - '''This Structure is good for the pile of independent configs needed for most actual systems''' - __name__ = 'Base' + '''This Structure is good for the pile of independent configs + needed for most actual systems''' + name = 'Base' __version__ = '$Id$' __author__ = 'bcfg-dev@mcs.anl.gov' __child__ = Bcfg2.Server.Plugin.StructFile @@ -16,8 +18,11 @@ class Base(Bcfg2.Server.Plugin.StructurePlugin, '''base creates independent clauses based on client metadata''' def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) + Bcfg2.Server.Plugin.Structure.__init__(self) try: - Bcfg2.Server.Plugin.XMLDirectoryBacked.__init__(self, self.data, self.core.fam) + Bcfg2.Server.Plugin.XMLDirectoryBacked.__init__(self, + self.data, + self.core.fam) except OSError: self.logger.error("Failed to load Base repository") raise Bcfg2.Server.Plugin.PluginInitError @@ -26,6 +31,7 @@ class Base(Bcfg2.Server.Plugin.StructurePlugin, '''Build structures for client described by metadata''' ret = lxml.etree.Element("Independant", version='2.0') fragments = reduce(lambda x, y: x+y, - [base.Match(metadata) for base in self.entries.values()], []) + [base.Match(metadata) for base + in self.entries.values()], []) [ret.append(copy.deepcopy(frag)) for frag in fragments] return [ret] -- cgit v1.2.3-1-g7c22