def reloadModules(self, args): # get ModuleManager-instance moduleManager = Activator().getInstance('ModuleManager') # get Dispatcher-instance dispatcher = Activator().getInstance('Dispatcher') # stop ModuleManager if running try: if moduleManager.isModuleRunning(): # stop moduleManager.stopModule() # check if we got a running module tries = 0 triesMax = 75 nap = 0.2 isRunning = True while isRunning and tries < triesMax: time.sleep(nap) tries += 1 isRunning = moduleManager.isModuleRunning() if isRunning: raise Exception, "Modules running after %d seconds" % (triesMax * nap) except Exception, e: self.logger.error("Error when stopping ModuleManager (%s)" % (e)) # return result return Result('Error when stopping ModuleManager', e)
def modstop(self, args): # mod-name module = args[0].strip() # get ModuleManager-instance moduleManager = Activator().getInstance('ModuleManager') # check if running if not moduleManager.isModuleRunning(module): return Result('Module not running: %s' % module, None) # stop it try: moduleManager.stopModule(module) except Exception, e: # return result return Result('Error when stopping Module: %s' % module, e)