Commit ebe6cf38 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Fix exit code of “gnt-cluster verify”

With commit fcad7225

 LU-generated jobs are used, but the
exit code must still be backwards-compatible.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 42539276
......@@ -476,12 +476,23 @@ def VerifyCluster(opts, args):
jex.AddJobId(None, status, job_id)
results = jex.GetResults()
bad_cnt = len([row for row in results if not row[0]])
if bad_cnt == 0:
(bad_jobs, bad_results) = \
map(len,
# Convert iterators to lists
map(list,
# Count errors
map(compat.partial(itertools.ifilterfalse, bool),
# Convert result to booleans in a tuple
zip(*((job_success, len(op_results) == 1 and op_results[0])
for (job_success, op_results) in results)))))
if bad_jobs == 0 and bad_results == 0:
rcode = constants.EXIT_SUCCESS
else:
ToStdout("%s job(s) failed while verifying the cluster.", bad_cnt)
rcode = constants.EXIT_FAILURE
if bad_jobs > 0:
ToStdout("%s job(s) failed while verifying the cluster.", bad_jobs)
return rcode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment