1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-19 04:59:10 +03:00

uptodateness: extract function get_utdv_distances

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13658
This commit is contained in:
Joe Guo
2018-10-03 23:21:11 +13:00
committed by Andrew Bartlett
parent ac1fba31c4
commit bbef7d6727
2 changed files with 28 additions and 22 deletions

View File

@ -45,6 +45,7 @@ from samba.uptodateness import (
get_own_cursor,
get_utdv,
get_utdv_edges,
get_utdv_distances,
)
COMMON_OPTIONS = [
@ -691,28 +692,7 @@ class cmd_uptodateness(GraphCommand):
utdv_edges = get_utdv_edges(local_kcc, dsas, part_dn, lp, creds)
distances = {}
max_distance = 0
for dn1 in dsas:
try:
peak = utdv_edges[dn1][dn1]
except KeyError as e:
peak = 0
d = {}
distances[dn1] = d
for dn2 in dsas:
if dn2 in utdv_edges:
if dn1 in utdv_edges[dn2]:
dist = peak - utdv_edges[dn2][dn1]
d[dn2] = dist
if dist > max_distance:
max_distance = dist
else:
print("Missing dn %s from UTD vector" % dn1,
file=sys.stderr)
else:
print("missing dn %s from UTD vector list" % dn2,
file=sys.stderr)
distances, max_distance = get_utdv_distances(utdv_edges, dsas)
digits = min(max_digits, len(str(max_distance)))
if digits < 1: