[Kimchi-devel] [PATCH] Change log message if command to run is not found

Jose Ricardo Ziviani joserz at linux.vnet.ibm.com
Mon May 25 17:02:56 UTC 2015


 - When run_command does not find the command it handles
   the exception by logging it as an error. However that
   might not be an error, but the caller has no chance to
   work around it. Now, the exception is logged as debug and
   the caller is responsible to check the return code to
   decide what to do with such error.

Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
 src/kimchi/utils.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index d71338a..ff3a5da 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -223,6 +223,11 @@ def run_command(cmd, timeout=None):
         return out, error, proc.returncode
     except TimeoutExpired:
         raise
+    except OSError as e:
+        msg = "Impossible to execute '%s'" % ' '.join(cmd)
+        kimchi_log.debug("%s", msg)
+
+        return None, "%s %s" % (msg, e), -1
     except Exception as e:
         msg = "Failed to run command: %s." % " ".join(cmd)
         msg = msg if proc is None else msg + "\n  error code: %s."
-- 
1.9.1




More information about the Kimchi-devel mailing list