[Kimchi-devel] [PATCH] Disable static path checking by cherrypy

Christy Perez christy at linux.vnet.ibm.com
Wed Jan 21 19:51:15 UTC 2015


CherryPy has a checker module that runs certain tests for resources.
One such test is for static paths, in which is tests all resources
using a non-existent html file. Since Kimchi is not a static web app,
this check can be safely disregarded.

The motivation behind this change is the following scenario:

The need to treat a certain flavor of a resource differently takes
advantage of the base model passed to the control's init function.
When calling the base model function to retreive the desired property,
an exception is thrown because the underlying resource doesn't exist.

This brings to light that any use of the base model from the init
of any control object will result in the same checker issue.

To easily test this issue:
- Add the following line to the __init__ function in control/vms.py:
    model.vm_lookup(self.ident.decode('utf-8'))
- Run the rest tests: $ sudo ./run_tests.sh test_rest.RestTests

See: cherrypy._cpchecker

Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
 src/kimchi/config.py.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index 83a5dd0..86ca862 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -23,10 +23,9 @@ import os
 import platform
 import threading
 
-
+from cherrypy import checker
 from ConfigParser import SafeConfigParser
 
-
 from kimchi.xmlutils.utils import xpath_get_text
 
 __version__ = "@kimchiversion@"
@@ -40,7 +39,6 @@ kimchiLock = threading.Lock()
 # Storage pool constant for read-only pool types
 READONLY_POOL_TYPE = ['iscsi', 'scsi', 'mpath']
 
-
 def get_object_store():
     return os.path.join(paths.state_dir, 'objectstore')
 
@@ -182,6 +180,8 @@ class UIConfig(dict):
 class KimchiConfig(dict):
     # session time out is 10 minutes
     SESSIONSTIMEOUT = 10
+    global checker
+    checker.check_static_paths = False
 
     kimchi_config = {
         '/': {
-- 
1.9.3




More information about the Kimchi-devel mailing list