summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Ldap.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/Ldap.py')
-rw-r--r--src/lib/Server/Plugins/Ldap.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Ldap.py b/src/lib/Server/Plugins/Ldap.py
index 4f10d8ca6..06ecaed7b 100644
--- a/src/lib/Server/Plugins/Ldap.py
+++ b/src/lib/Server/Plugins/Ldap.py
@@ -1,9 +1,18 @@
import imp
+import logging
+import sys
import time
-import ldap
import Bcfg2.Options
import Bcfg2.Server.Plugin
+logger = logging.getLogger('Bcfg2.Plugins.Ldap')
+
+try:
+ import ldap
+except:
+ logger.error("Unable to load ldap module. Is python-ldap installed?")
+ raise ImportError
+
# time in seconds between retries after failed LDAP connection
RETRY_DELAY = 5
# how many times to try reaching the LDAP server if a connection is broken
@@ -81,7 +90,8 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
self.debug_log("LdapPlugin debug: query '" + query.name +
"' not applicable to host '" + metadata.hostname + "'")
return data
- except Exception, error_msg:
+ except Exception:
+ error_msg = sys.exc_info()[1]
if self.debug_flag:
raise
else: