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

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@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__':

On 06/08/2016 04:06 PM, Aline Manera wrote:
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.
Humm, there was problems with Server importing auth, which imports get_all_tabs from plugins. Before, 'get_all_tabs' was in utils and utils was instanciating Plugins(). This way it was possible to see Kimchi/Gingerbase/Ginger being loaded and running feature tests, then right after plugins being loaded the execution stopped, with the message of wrong option (if passed of course). However (and this is good) the changes of move get_all_tabs to pluginsmanager.py seems to make this patch useless, once I cannot reproduce the problem anymore.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@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__':
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (2)
-
Aline Manera
-
Rodrigo Trujillo