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

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Fri Feb 21 09:41:42 UTC 2014


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'
-- 
1.8.4.2




More information about the Kimchi-devel mailing list