summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2016-08-17 03:28:20 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2017-03-21 17:44:20 +0100
commit0985c2aed06c14d8b79805d21449f2f1d31dd20c (patch)
treef68a94eb35a064644f06b614af735a5faf0258e7
parentb914052d7c33cc45012f693763189aa7db7a78a2 (diff)
downloadbcfg2-0985c2aed06c14d8b79805d21449f2f1d31dd20c.tar.gz
bcfg2-0985c2aed06c14d8b79805d21449f2f1d31dd20c.tar.bz2
bcfg2-0985c2aed06c14d8b79805d21449f2f1d31dd20c.zip
Server/Plugins/Ldap: Fix module name
If the module name contains slashes, python will issue an warning: > Ldap/config.py:1: RuntimeWarning: Parent module '__Ldap_/root/repo/Ldap/config' not found while handling absolute import > from Bcfg2.Server.Plugins.Ldap import LdapConnection, LdapQuery So we simply use the basename without the file extension for the module name.
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Ldap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Ldap.py b/src/lib/Bcfg2/Server/Plugins/Ldap.py
index a51f47dae..770419ba5 100644
--- a/src/lib/Bcfg2/Server/Plugins/Ldap.py
+++ b/src/lib/Bcfg2/Server/Plugins/Ldap.py
@@ -33,7 +33,8 @@ class ConfigFile(Bcfg2.Server.Plugin.FileBacked):
def Index(self):
""" Get the queries from the config file """
try:
- module = imp.load_source(safe_module_name('Ldap', self.name),
+ module_name = os.path.splitext(os.path.basename(self.name))[0]
+ module = imp.load_source(safe_module_name('Ldap', module_name),
self.name)
except: # pylint: disable=W0702
err = sys.exc_info()[1]