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

Ramon Medeiros ramonn at linux.vnet.ibm.com
Mon May 25 19:11:25 UTC 2015


Reviewed-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>

On 05/25/2015 02:02 PM, Jose Ricardo Ziviani wrote:
>   - 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."

-- 

Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn at br.ibm.com




More information about the Kimchi-devel mailing list