diff options
-rw-r--r-- | src/lib/Server/Core.py | 12 | ||||
-rw-r--r-- | src/lib/Server/Plugin.py | 1 | ||||
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 712c87c8e..4e3534c89 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -55,6 +55,7 @@ class Core(Component): self.cfile = cfile self.cron = {} self.plugins = {} + self.plugin_blacklist = {} self.revision = '-1' self.password = password self.encoding = encoding @@ -66,6 +67,13 @@ class Core(Component): for plugin in plugins: if not plugin in self.plugins: self.init_plugins(plugin) + # Remove blacklisted plugins + for p, bl in self.plugin_blacklist.items(): + if len(bl) > 0: + logger.error("The following plugins conflict with %s;" + "Unloading %s" % (p, bl)) + for plug in bl: + del self.plugins[plug] expl = [plug for (name, plug) in self.plugins.iteritems() if plug.experimental] if expl: @@ -129,6 +137,10 @@ class Core(Component): logger.error("Failed to load plugin %s" % (plugin)) return plug = getattr(mod, plugin) + # blacklist conflicting plugins + cplugs = [conflict for conflict in plug.conflicts + if conflict in self.plugins] + self.plugin_blacklist[plug.name] = cplugs try: self.plugins[plugin] = plug(self, self.datastore) except PluginInitError: diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 2e4974a84..f3b97b336 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -56,6 +56,7 @@ class Plugin(object): __rmi__ = ['toggle_debug'] experimental = False deprecated = False + conflicts = [] def __init__(self, core, datastore): object.__init__(self) diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 875562456..2e0b3bd4a 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -498,6 +498,7 @@ class Packages(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.StructureValidator, Bcfg2.Server.Plugin.Generator): name = 'Packages' + conflicts = ['Pkgmgr'] experimental = True __rmi__ = Bcfg2.Server.Plugin.Plugin.__rmi__ + ['Refresh'] |