summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2015-04-02 11:03:42 +1300
committerAndrew Bartlett <abartlet@samba.org>2015-05-29 11:08:21 +0200
commit4c5761c057be345d64e6d4e14924f9cad4d51f62 (patch)
treed0c8a771ac151209e467c25cf9356bda9f5377a8 /source4
parentd0f9f32d0a912972b5b23a4c9015a706d539b638 (diff)
downloadsamba-4c5761c057be345d64e6d4e14924f9cad4d51f62.tar.gz
KCC: Debugging changes -- including DEBUG_FN() function
DEBUG_FN(msg) prefixes the msg with the function name and line no. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/samba_kcc32
1 files changed, 20 insertions, 12 deletions
diff --git a/source4/scripting/bin/samba_kcc b/source4/scripting/bin/samba_kcc
index 3696e26d79a..3a2c48871c4 100755
--- a/source4/scripting/bin/samba_kcc
+++ b/source4/scripting/bin/samba_kcc
@@ -218,9 +218,9 @@ class KCC(object):
res = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE,
attrs=["objectGUID"])
except ldb.LdbError, (enum, estr):
- DEBUG("Search for %s failed: %s. This typically happens in"
- " --importldif mode due to lack of module support",
- dn, estr)
+ logger.warning("Search for %s failed: %s. This typically happens"
+ " in --importldif mode due to lack of module"
+ " support.", dn, estr)
try:
# We work around the failure above by looking at the
# dsServiceName that was put in the fake rootdse by
@@ -530,9 +530,9 @@ class KCC(object):
if mydsa.is_ro() or opts.readonly:
for connect in mydsa.connect_table.values():
if connect.to_be_deleted:
- DEBUG_GREEN("TO BE DELETED:\n%s" % connect)
+ DEBUG_FN("TO BE DELETED:\n%s" % connect)
if connect.to_be_added:
- DEBUG_GREEN("TO BE ADDED:\n%s" % connect)
+ DEBUG_FN("TO BE ADDED:\n%s" % connect)
# Peform deletion from our tables but perform
# no database modification
@@ -919,10 +919,11 @@ class KCC(object):
if dnstr not in needed_rep_table:
delete_reps.add(dnstr)
+ DEBUG_FN('current %d needed %d delete %d' % (len(current_rep_table),
+ len(needed_rep_table), len(delete_reps)))
+
if delete_reps:
- DEBUG('current %d needed %d delete %d', len(current_rep_table),
- len(needed_rep_table), len(delete_reps))
- DEBUG('deleting these reps: %s', delete_reps)
+ DEBUG('deleting these reps: %s' % delete_reps)
for dnstr in delete_reps:
del current_rep_table[dnstr]
@@ -1065,9 +1066,9 @@ class KCC(object):
if opts.attempt_live_connections:
DEBUG_RED("merge_failed_links() is NOT IMPLEMENTED")
else:
- DEBUG("skipping merge_failed_links() because it requires "
- "real network connections\n"
- "and we weren't asked to --attempt-live-connections")
+ DEBUG_FN("skipping merge_failed_links() because it requires "
+ "real network connections\n"
+ "and we weren't asked to --attempt-live-connections")
def setup_graph(self, part):
"""Set up a GRAPH, populated with a VERTEX for each site
@@ -1181,7 +1182,7 @@ class KCC(object):
bhs = []
- logger.debug("get_all_bridgeheads: %s" % transport)
+ logger.debug("get_all_bridgeheads: %s" % transport.name)
if 'Site-5' in site.site_dnstr:
DEBUG_RED("get_all_bridgeheads with %s, part%s, partial_ok %s"
" detect_failed %s" % (site.site_dnstr, part.partstr,
@@ -3086,6 +3087,13 @@ for _color in ('DARK_RED', 'RED', 'DARK_GREEN', 'GREEN', 'YELLOW',
_globals['DEBUG_' + _color] = partial(_color_debug, color=_globals[_color])
+def DEBUG_FN(msg=''):
+ import traceback
+ filename, lineno, function, text = traceback.extract_stack(None, 2)[0]
+ DEBUG("%s%s:%s%s %s%s()%s '%s'" % (CYAN, filename, BLUE, lineno,
+ CYAN, function, C_NORMAL, msg))
+
+
##################################################
# samba_kcc entry point
##################################################