1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

KCC: make --verify graph errors fatal

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>
This commit is contained in:
Douglas Bagnall 2015-03-18 14:23:21 +13:00 committed by Andrew Bartlett
parent d68387774d
commit 0331c53b4c
2 changed files with 11 additions and 5 deletions

View File

@ -2559,7 +2559,7 @@ def verify_graph_directed_double_ring_or_small(edges, vertices, edge_vertices):
def verify_graph(title, edges, vertices=None, directed=False, properties=(), fatal=False,
def verify_graph(title, edges, vertices=None, directed=False, properties=(), fatal=True,
debug=None):
errors = []
if debug is None:
@ -2596,7 +2596,8 @@ def verify_graph(title, edges, vertices=None, directed=False, properties=(), fat
if errors:
if fatal:
raise KCCGraphError("The graph lacks the following properties:\n" + '\n'.join(errors))
raise KCCGraphError("The '%s' graph lacks the following properties:\n%s" %
(title, '\n'.join('%s: %s' % x for x in errors)))
debug(("%s%s%s FAILED:" % (MAGENTA, title, RED)))
for p, e in errors:
debug(" %18s: %s%s%s" %(p, DARK_YELLOW, e, RED))
@ -2605,7 +2606,7 @@ def verify_graph(title, edges, vertices=None, directed=False, properties=(), fat
def verify_and_dot(basename, edges, vertices=None, label=None, destdir=None,
reformat_labels=True, directed=False, properties=(), fatal=False,
reformat_labels=True, directed=False, properties=(), fatal=True,
debug=None, verify=True, dot_files=False):
title = '%s %s' % (basename, label or '')

View File

@ -3242,5 +3242,10 @@ if opts.importldif:
if rc != 0:
sys.exit(rc)
rc = kcc.run(opts.dburl, lp, creds, opts.forced_local_dsa)
sys.exit(rc)
try:
rc = kcc.run(opts.dburl, lp, creds, opts.forced_local_dsa)
sys.exit(rc)
except KCCGraphError, e:
print e
sys.exit(1)