summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Ldap.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-10-13 16:25:08 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-10-13 16:25:08 -0500
commitdb05bc553a28334795dc2990cacb03717798aebd (patch)
tree597433a20ee1cae4e24031569705bdfa50edfb6a /src/lib/Server/Plugins/Ldap.py
parent4d87c5c2022c01dc171a276ca1aefde3e3fe43da (diff)
parent4982bb54895eae5e338eb67e8c6ddd1bc52396ca (diff)
downloadbcfg2-db05bc553a28334795dc2990cacb03717798aebd.tar.gz
bcfg2-db05bc553a28334795dc2990cacb03717798aebd.tar.bz2
bcfg2-db05bc553a28334795dc2990cacb03717798aebd.zip
Merge branch 'plugin/ldap/dev/trehn' of https://github.com/trehn/bcfg2
Diffstat (limited to 'src/lib/Server/Plugins/Ldap.py')
-rw-r--r--src/lib/Server/Plugins/Ldap.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/lib/Server/Plugins/Ldap.py b/src/lib/Server/Plugins/Ldap.py
index 06ecaed7b..f1e2198d2 100644
--- a/src/lib/Server/Plugins/Ldap.py
+++ b/src/lib/Server/Plugins/Ldap.py
@@ -2,6 +2,7 @@ import imp
import logging
import sys
import time
+import traceback
import Bcfg2.Options
import Bcfg2.Server.Plugin
@@ -64,7 +65,7 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
name = "Ldap"
version = "$Revision: $"
experimental = True
- debug_flag = True
+ debug_flag = False
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
@@ -76,6 +77,7 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
self.logger.error(message)
def get_additional_data(self, metadata):
+ query = None
try:
data = {}
self.debug_log("LdapPlugin debug: found queries " +
@@ -91,13 +93,18 @@ class Ldap(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector):
"' not applicable to host '" + metadata.hostname + "'")
return data
except Exception:
- error_msg = sys.exc_info()[1]
- if self.debug_flag:
- raise
- else:
+ if hasattr(query, "name"):
+ Bcfg2.Server.Plugin.logger.error("LdapPlugin error: " +
+ "Exception during processing of query named '" +
+ str(query.name) +
+ "', query results will be empty" +
+ " and may cause bind failures")
+ for line in traceback.format_exception(sys.exc_info()[0],
+ sys.exc_info()[1],
+ sys.exc_info()[2]):
Bcfg2.Server.Plugin.logger.error("LdapPlugin error: " +
- str(error_msg))
- return {}
+ line.replace("\n", ""))
+ return {}
class LdapConnection(object):
"""