summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTorsten Rehn <torsten@rehn.tel>2011-05-09 15:54:42 +0200
committerSol Jerome <sol.jerome@gmail.com>2011-06-14 12:36:44 -0500
commit31cfa9f3a7b9f4ffd5fa32e22042681015489149 (patch)
tree99e7494983f811fbebcfe1737e5aa80a4be4b412 /src
parente810fa812c23e87fc43908f8f72c4c6d751df625 (diff)
downloadbcfg2-31cfa9f3a7b9f4ffd5fa32e22042681015489149.tar.gz
bcfg2-31cfa9f3a7b9f4ffd5fa32e22042681015489149.tar.bz2
bcfg2-31cfa9f3a7b9f4ffd5fa32e22042681015489149.zip
log more useful error message if python-ldap is not installed
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Ldap.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/Ldap.py b/src/lib/Server/Plugins/Ldap.py
index 7d6d0b609..06ecaed7b 100644
--- a/src/lib/Server/Plugins/Ldap.py
+++ b/src/lib/Server/Plugins/Ldap.py
@@ -1,10 +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