[Kimchi-devel] [PATCH v2][Wok 5/8] Load Wok Server after options checkings

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Mon Jun 6 19:13:33 UTC 2016


This patch moves Server.py import right before instanciate the class.
Then all following imports and initializations required by Server module
are done after command line options checkings.
This way avoid problems like init and load plugins then wokd stops due
to wrong command line option.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/wokd.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/wokd.in b/src/wokd.in
index 962581d..3cf90f8 100644
--- a/src/wokd.in
+++ b/src/wokd.in
@@ -27,7 +27,6 @@ sys.path.insert(1, '@pythondir@')
 
 from optparse import OptionParser
 
-import wok.server
 import wok.config as config
 
 
@@ -100,6 +99,11 @@ def main(options):
     setattr(options, 'max_body_size',
             config.config.get('server', 'max_body_size'))
 
+
+    # Wok Server module must be imported after options checkings. Otherwise it
+    # is possible that server start some functions and then fail due to wrong
+    # parameters passed
+    import wok.server
     wok.server.main(options)
 
 if __name__ == '__main__':
-- 
2.1.0




More information about the Kimchi-devel mailing list