Esempio n. 1
0
	def loadModules(self):
		log.msg("Loading modules...")
		#reload the config, in case it's changed since we started

		try:
			cfg.loadConfig()
		except:
			log.msg("Error loading config:\n" + traceback.format_exc(), log.ERROR)
			return True

		errors = self.refreshAvailableModules()

		# Register active modules.
		for name in self._modules.keys():
			if name in self._available_modules:
				self.registerModule(self._available_modules[name], name)
			else:
				log.msg("%s not found in available modules, cannot be activated." % name, log.ERROR)

		return errors
Esempio n. 2
0
    def makeService(self, options):
        import sys
        from fb.config import cfg

        cfg.loadConfig(options['configs'])

        if options['showconfig']:
            cfg._cfg.dump(sys.stdout)

        from fb.audit import log

        # Friendly warning - I ran into this once, hopefully this will help others in the future.
        try:
            from OpenSSL import SSL
        except:
            log.msg(
                "Warning, we can't import SSL. You may have trouble connecting to some servers. If so, try installing pyOpenSSL."
            )

        if cfg.connect.method not in cfg.connect:
            log.msg("Connector %s specified but not found in settings." %
                    config.connect.method)
            sys.exit(1)

        try:
            connector = __import__('fb.connectors.' + cfg.connect.method,
                                   globals(), locals(), ['createService'], -1)
        except ImportError:
            log.msg("Coudln't import connector: %s" % cfg.connect.method)
            raise

        log.msg("Successfully loaded connector %s" % cfg.connect.method)

        app = service.MultiService()

        connector.createService().setServiceParent(app)

        from fb.api.core import api
        api.launch(app)

        return app
Esempio n. 3
0
	def makeService(self, options):
		import sys
		from fb.config import cfg

		cfg.loadConfig(options['configs'])

		if options['showconfig']:
			cfg._cfg.dump(sys.stdout)

		from fb.audit import log

		# Friendly warning - I ran into this once, hopefully this will help others in the future.
		try:
			from OpenSSL import SSL
		except:
			log.msg("Warning, we can't import SSL. You may have trouble connecting to some servers. If so, try installing pyOpenSSL.")

		if cfg.connect.method not in cfg.connect:
			log.msg("Connector %s specified but not found in settings." % config.connect.method)
			sys.exit(1)

		try:
			connector = __import__('fb.connectors.' + cfg.connect.method, globals(), locals(), ['createService'], -1)
		except ImportError:
			log.msg("Coudln't import connector: %s" % cfg.connect.method)
			raise

		log.msg("Successfully loaded connector %s" % cfg.connect.method)

		app = service.MultiService()

		connector.createService().setServiceParent(app)

		from fb.api.core import api
		api.launch(app)

		return app