[Kimchi-devel] [PATCH] Issue #320: give friendly prompt when kimchid fails to run with non-root user

Ramon Medeiros ramonn at linux.vnet.ibm.com
Fri Feb 21 18:52:57 UTC 2014


Aline sent a patch to correct this, also, this kind of fix is very 
superficial.

If the user delete the log? I guess it would pass since the user is non-root

On 02/21/2014 05:45 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> If a non-root/non-sudo user tries to run kimchid, it fails with the
> verbose stacktrace.
>
> This is not friendly to user.
>
> There should be a check for these cases, allowing kimchid to fail
> gracefully.
>
> Issue:
> https://github.com/kimchi-project/kimchi/issues/320
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/server.py | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/server.py b/src/kimchi/server.py
> index 6dd0404..f93b6ee 100644
> --- a/src/kimchi/server.py
> +++ b/src/kimchi/server.py
> @@ -158,8 +158,13 @@ class Server(object):
>               pass
>
>           cherrypy.log.screen = True
> -        cherrypy.log.access_file = options.access_log
> -        cherrypy.log.error_file = options.error_log
> +        try:
> +            cherrypy.log.access_file = options.access_log
> +            cherrypy.log.error_file = options.error_log
> +        except IOError as e:
> +            print e
> +            print "Please run kimchi with root user"
> +            exit()
>
>           logLevel = LOGGING_LEVEL.get(options.log_level, logging.DEBUG)
>           dev_env = options.environment != 'production'


-- 
Ramon Nunes Medeiros
Software Engineer - 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