def mainLoop(env): """ Main event loop which will process all registerd threads in a loop. It will run as long env.active is set to True. """ log = logging.getLogger(__name__) try: # Load plugins oreg = ObjectRegistry.getInstance() #@UnusedVariable pr = PluginRegistry() #@UnusedVariable cr = PluginRegistry.getInstance("CommandRegistry") httpd = PluginRegistry.getInstance("HTTPService") if not hasattr(sys, "_called_from_test") or sys._called_from_test is False: httpd.thread.join() # Catchall, pylint: disable=W0703 except Exception as detail: log.critical("unexpected error in mainLoop") log.exception(detail) except KeyboardInterrupt: log.info("console requested shutdown") finally: if not hasattr(sys, "_called_from_test") or sys._called_from_test is False: shutdown()
def use_test_config(request): Environment.reset() Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "test_conf") Environment.noargs = True env = Environment.getInstance() if has_dbus: # Enable DBus runner dr = DBusRunner() dr.start() PluginRegistry(component='gosa.client.module') # @UnusedVariable env.active = True def shutdown(): env.active = False # Wait for threads to shut down for t in env.threads: if hasattr(t, 'stop'): t.stop() if hasattr(t, 'cancel'): t.cancel() t.join(2) PluginRegistry.shutdown() if has_dbus: dr.stop() request.addfinalizer(shutdown)
def use_test_config(): Environment.reset() Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "..", "test_conf") Environment.noargs = True oreg = ObjectRegistry.getInstance() # @UnusedVariable pr = PluginRegistry() # @UnusedVariable cr = PluginRegistry.getInstance("CommandRegistry") # @UnusedVariable