summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2019-05-07 17:06:01 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2019-05-10 18:56:54 +0200
commitad2b80f4d2b940f7b4a15c94e6324b35fe0a762e (patch)
treea7c54ff8ae584791d910a192a744cc4be1700583
parent0770075e38442070c771f769ed8b0ce19636182d (diff)
downloadbcfg2-ad2b80f4d2b940f7b4a15c94e6324b35fe0a762e.tar.gz
bcfg2-ad2b80f4d2b940f7b4a15c94e6324b35fe0a762e.tar.bz2
bcfg2-ad2b80f4d2b940f7b4a15c94e6324b35fe0a762e.zip
Lint: Import lint plugins with package name
When importing packages we should not pollute the global modules namespace and always import new modules with their package name.
-rw-r--r--src/lib/Bcfg2/Server/Lint/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py
index 873e5f149..66c8180f4 100644
--- a/src/lib/Bcfg2/Server/Lint/__init__.py
+++ b/src/lib/Bcfg2/Server/Lint/__init__.py
@@ -327,7 +327,10 @@ class LintPluginOption(Bcfg2.Options.Option):
plugins = [p.__name__ for p in namespace.plugins]
for loader, name, _is_pkg in walk_packages(path=__path__):
try:
- module = loader.find_module(name).load_module(name)
+ module_name = 'Bcfg2.Server.Lint.%s' % name
+ module = loader \
+ .find_module(module_name) \
+ .load_module(module_name)
plugin = getattr(module, name)
if plugin.__serverplugin__ is None or \
plugin.__serverplugin__ in plugins: