kcc graph verifier: use __doc__ description for error explanation
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 15 May 2018 02:40:36 +0000 (14:40 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 May 2018 23:57:16 +0000 (01:57 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/kcc/graph.py
python/samba/kcc/graph_utils.py

index 1e63f7c..d87530d 100644 (file)
@@ -188,7 +188,7 @@ def get_spanning_tree_edges(graph, my_site, label=None, verify=False,
                                       properties=('complete', 'connected'))
                 if errors:
                     DEBUG('spanning tree edge set %s FAILED' % edgeType)
-                    for p, e in errors:
+                    for p, e, doc in errors:
                         DEBUG("%18s: %s" % (p, e))
                     raise KCCError("spanning tree failed")
 
index e4fa821..291fd48 100644 (file)
@@ -294,7 +294,7 @@ def verify_graph(edges, vertices=None, directed=False, properties=()):
         try:
             f(edges, vertices, edge_vertices)
         except GraphError as e:
-            errors.append((p, e))
+            errors.append((p, e, f.__doc__))
 
     return errors
 
@@ -319,13 +319,13 @@ def verify_and_dot(basename, edges, vertices=None, label=None,
         if errors:
             title = '%s %s' % (basename, label or '')
             debug(("%s%s%s FAILED:" % (MAGENTA, title, RED)))
-            for p, e in errors:
+            for p, e, doc in errors:
                 debug(" %18s: %s%s%s" % (p, DARK_YELLOW, e, RED))
             if fatal:
                 raise GraphError("The '%s' graph lacks the following "
                                  "properties:\n%s" %
-                                 (title, '\n'.join('%s: %s' % x
-                                                   for x in errors)))
+                                 (title, '\n'.join('%s: %s' % (p, e)
+                                                   for p, e, doc in errors)))
 
 
 def list_verify_tests():