On Fri, Aug 12, 2011 at 3:32 PM, Michael Hanselmann <[email protected]> wrote:
> With commit fcad7225e3fc4 LU-generated jobs are used, but the
> exit code must still be backwards-compatible.
> ---
>  lib/client/gnt_cluster.py |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
> index 120179c..7eb11e5 100644
> --- a/lib/client/gnt_cluster.py
> +++ b/lib/client/gnt_cluster.py
> @@ -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
>
> --
> 1.7.6

LGTM.

René

Reply via email to