samba-tool visualize ntdsconn: properly sort/group vertices
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 1 Jun 2018 05:14:32 +0000 (17:14 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 10 Jun 2018 17:02:20 +0000 (19:02 +0200)
The vertex is now a tuple, with the RODC state added.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/visualize.py

index e8fff9407ed74a82e06d63ad92691ad06f642328..bfd7d3bf341317ab26a7d8edb494677f81cf4b4b 100644 (file)
@@ -188,6 +188,12 @@ def get_dnstr_site(dn):
     return dn
 
 
+def get_dnstrlist_site(t):
+    """Helper function for sorting and grouping lists of (DN, ...) tuples
+    by site, if possible."""
+    return get_dnstr_site(t[0])
+
+
 def colour_hash(x):
     """Generate a randomish but consistent darkish colour based on the
     given object."""
@@ -586,13 +592,12 @@ class cmd_ntdsconn(GraphCommand):
                     for e in source_denies:
                         epilog.append('  %s -> %s\n' % e)
 
-
             s = distance_matrix(vertices, graph_edges,
                                 utf8=utf8,
                                 colour=color_scheme,
                                 shorten_names=shorten_names,
                                 generate_key=key,
-                                grouping_function=get_dnstr_site,
+                                grouping_function=get_dnstrlist_site,
                                 row_comments=rodc_status)
 
             epilog = ''.join(epilog)