From f5444c339c1223e4dd51a7d0448dfe9655069168 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 7 Jan 2014 15:43:04 -0500 Subject: bcfg2-lint: fixed automatically loading server plugin lint plugins --- src/lib/Bcfg2/Server/Lint/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py index 8a793fd94..9b3e6ece2 100644 --- a/src/lib/Bcfg2/Server/Lint/__init__.py +++ b/src/lib/Bcfg2/Server/Lint/__init__.py @@ -13,6 +13,7 @@ import lxml.etree import Bcfg2.Options import Bcfg2.Server.Core import Bcfg2.Server.Plugins +from Bcfg2.Compat import walk_packages def _ioctl_GWINSZ(fd): # pylint: disable=C0103 @@ -297,11 +298,10 @@ class LintPluginAction(Bcfg2.Options.ComponentAction): bases = ['Bcfg2.Server.Lint'] def __call__(self, parser, namespace, values, option_string=None): - for plugin in getattr(Bcfg2.Options.setup, "plugins", []): - module = sys.modules[plugin.__module__] - if hasattr(module, "%sLint" % plugin.name): - print("Adding lint plugin %s" % plugin) - values.append(plugin) + plugins = getattr(Bcfg2.Options.setup, "plugins", []) + for lint_plugin in walk_packages(path=__path__): + if lint_plugin[1] in plugins: + values.append(lint_plugin[1]) Bcfg2.Options.ComponentAction.__call__(self, parser, namespace, values, option_string) -- cgit v1.2.3-1-g7c22