On 06/06/2016 04:13 PM, Rodrigo Trujillo wrote:
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.
Could you explain better the problem?
I checked server.py and there is no function being called on this module.
Seems it is an workaround to a deeper issue.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)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__':