Permalink
Browse files

Merge branch 'plugin/ldap/dev/trehn' of https://github.com/trehn/bcfg2

  • Loading branch information...
2 parents 4d87c5c + 4982bb5 commit db05bc553a28334795dc2990cacb03717798aebd @solj solj committed Oct 13, 2011
Showing with 14 additions and 7 deletions.
  1. +14 −7 src/lib/Server/Plugins/Ldap.py
@@ -2,6 +2,7 @@
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 @@ def debug_log(self, message, flag = None):
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 @@ def get_additional_data(self, metadata):
"' 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):
"""

0 comments on commit db05bc5

Please sign in to comment.