[Kimchi-devel] [PATCH] [Wok 1/2] Bug fix: Set application options globally on Server() instead of wokd command

Aline Manera alinefm at linux.vnet.ibm.com
Tue Feb 7 18:34:04 UTC 2017


wokd is a command line tool which relies on Server() instance to start
up the web server. To run tests, the wokd command is not used. Instead
of that, the Server() instance handles the application options.
So instead of setting the options globally on wokd command, do that on
Server() to make it used overwhere.

This bug was introcuded by 713fd5caa and noticed while running Kimchi
tests.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/wok/server.py | 7 +++++++
 src/wokd.in       | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/wok/server.py b/src/wok/server.py
index 9b49c1a..f64a6a2 100644
--- a/src/wok/server.py
+++ b/src/wok/server.py
@@ -61,6 +61,13 @@ def set_no_cache():
 
 class Server(object):
     def __init__(self, options):
+        # Update config.config with the command line values
+        # So the whole application will have access to accurate values
+        for sec in config.config.sections():
+            for item in config.config.options(sec):
+                if hasattr(options, item):
+                    config.config.set(sec, item, str(getattr(options, item)))
+
         # Check proxy configuration
         check_proxy_config()
 
diff --git a/src/wokd.in b/src/wokd.in
index b701f34..29586a0 100644
--- a/src/wokd.in
+++ b/src/wokd.in
@@ -78,13 +78,6 @@ def main(options):
     setattr(options, 'access_log', os.path.join(options.log_dir, ACCESS_LOG))
     setattr(options, 'error_log', os.path.join(options.log_dir, ERROR_LOG))
 
-    # Update config.config with the command line values
-    # So the whole application will have access to accurate values
-    for sec in config.config.sections():
-        for item in config.config.options(sec):
-            if hasattr(options, item):
-                config.config.set(sec, item, str(getattr(options, item)))
-
     # Add non-option arguments
     setattr(options, 'max_body_size',
             config.config.get('server', 'max_body_size'))
-- 
2.9.3



More information about the Kimchi-devel mailing list