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

Leonardo Garcia lagarcia at linux.vnet.ibm.com
Tue Mar 25 14:21:09 UTC 2014


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})
 
-- 
1.8.5.3




More information about the Kimchi-devel mailing list