[Kimchi-devel] [PATCH ] Optimize return code check.

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Tue Mar 25 18:18:07 UTC 2014


Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>

On 03/25/2014 11:21 AM, Leonardo Garcia wrote:
> From: Leonardo Garcia <lagarcia at br.ibm.com>
>
> Instead of doing two comparisons, make just one and make this check
> faster.
>
> Signed-off-by: Leonardo Garcia <lagarcia at br.ibm.com>
> ---
>   src/kimchi/model/debugreports.py | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
> index 6ae282a..479d936 100644
> --- a/src/kimchi/model/debugreports.py
> +++ b/src/kimchi/model/debugreports.py
> @@ -68,10 +68,7 @@ class DebugReportsModel(object):
>               command = ['sosreport', '--batch', '--name=%s' % name]
>               output, error, retcode = run_command(command)
>
> -            if retcode < 0:
> -                raise OperationFailed("KCHDR0003E", {'name': name,
> -                                                     'err': retcode})
> -            elif retcode > 0:
> +            if retcode != 0:
>                   raise OperationFailed("KCHDR0003E", {'name': name,
>                                                        'err': retcode})
>




More information about the Kimchi-devel mailing list