1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-28 11:42:03 +03:00

uptodateness: extract function get_utdv_edges

Extract function to reuse later.

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:09:56 +13:00
committed by Andrew Bartlett
parent ff311f1dc7
commit ac1fba31c4
2 changed files with 32 additions and 22 deletions

View File

@ -44,6 +44,7 @@ from samba.uptodateness import (
get_partition,
get_own_cursor,
get_utdv,
get_utdv_edges,
)
COMMON_OPTIONS = [
@ -688,27 +689,7 @@ class cmd_uptodateness(GraphCommand):
if partition not in (part_dn, None):
continue # we aren't doing this partition
# we talk to each remote and make a matrix of the vectors
# -- for each partition
# normalise by oldest
utdv_edges = {}
for dsa_dn in dsas:
res = local_kcc.samdb.search(dsa_dn,
scope=SCOPE_BASE,
attrs=["dNSHostName"])
ldap_url = "ldap://%s" % res[0]["dNSHostName"][0]
try:
samdb = self.get_db(ldap_url, sambaopts, credopts)
cursors = get_utdv(samdb, part_dn)
own_usn, own_time = get_own_cursor(samdb)
remotes = {dsa_dn: own_usn}
for dn, guid, usn, t in cursors:
remotes[dn] = usn
except LdbError as e:
print("Could not contact %s (%s)" % (ldap_url, e),
file=sys.stderr)
continue
utdv_edges[dsa_dn] = remotes
utdv_edges = get_utdv_edges(local_kcc, dsas, part_dn, lp, creds)
distances = {}
max_distance = 0