[Kimchi-devel] [PATCH ] Optimize return code check.
Paulo Ricardo Paz Vital
pvital at linux.vnet.ibm.com
Tue Mar 25 18:40:12 UTC 2014
--
Reviewed-by: Paulo Vital <pvital at linux.vnet.ibm.com>
On Tue, 2014-03-25 at 11:21 -0300, 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