diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2016-08-17 17:17:22 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2016-08-17 21:00:05 +0200 |
commit | 8bcd3b7d717186f14bdd2482e46c2a6feee51767 (patch) | |
tree | db725e3a8d0c41e331ea98462fc5e8fee3a39d44 /src | |
parent | 14bd39d75e425b033a6996d9fffb1165edd7c4cd (diff) | |
download | bcfg2-8bcd3b7d717186f14bdd2482e46c2a6feee51767.tar.gz bcfg2-8bcd3b7d717186f14bdd2482e46c2a6feee51767.tar.bz2 bcfg2-8bcd3b7d717186f14bdd2482e46c2a6feee51767.zip |
Revert "removed duplicate plugins option"
This reverts commit 30634d07d5489f260f37cc86d150315f02c40865.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/models.py | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Server/models.py b/src/lib/Bcfg2/Server/models.py index 9c0153c74..65f17ee7c 100644 --- a/src/lib/Bcfg2/Server/models.py +++ b/src/lib/Bcfg2/Server/models.py @@ -4,20 +4,40 @@ import sys import logging import Bcfg2.Options import Bcfg2.Server.Plugins +from Bcfg2.Compat import walk_packages -LOGGER = logging.getLogger(__name__) +LOGGER = logging.getLogger('Bcfg2.Server.models') MODELS = [] INTERNAL_DATABASE_VERSION = None -class _OptionContainer(object): - """Options for Bcfg2 database models.""" +def _get_all_plugins(): + rv = [] + for submodule in walk_packages(path=Bcfg2.Server.Plugins.__path__, + prefix="Bcfg2.Server.Plugins."): + module = submodule[1].rsplit('.', 1)[-1] + if submodule[1] == "Bcfg2.Server.Plugins.%s" % module: + # we only include direct children of + # Bcfg2.Server.Plugins -- e.g., all_plugins should + # include Bcfg2.Server.Plugins.Cfg, but not + # Bcfg2.Server.Plugins.Cfg.CfgInfoXML + rv.append(module) + return rv + + +_ALL_PLUGINS = _get_all_plugins() + +class _OptionContainer(object): # we want to provide a different default plugin list -- # namely, _all_ plugins, so that the database is guaranteed to # work, even if /etc/bcfg2.conf isn't set up properly - options = [Bcfg2.Options.Common.plugins] + options = [ + Bcfg2.Options.Option( + cf=('server', 'plugins'), type=Bcfg2.Options.Types.comma_list, + default=_ALL_PLUGINS, dest="models_plugins", + action=Bcfg2.Options.PluginsAction)] @staticmethod def options_parsed_hook(): @@ -39,7 +59,7 @@ def load_models(plugins=None): global MODELS if not plugins: - plugins = Bcfg2.Options.setup.plugins + plugins = Bcfg2.Options.setup.models_plugins if MODELS: # load_models() has been called once, so first unload all of |