Пример #1
0
    def _load_all_plugins(self):
        LOG.debug("List of requested plugins: %s" % CONF.plugins)

        if len(CONF.plugins) > len(set(CONF.plugins)):
            raise RuntimeError("plugins config contains non-unique entries")

        # register required 'plugin_factory' property for each plugin
        for plugin in CONF.plugins:
            opts = [
                cfg.StrOpt('plugin_class', required=True),
            ]
            CONF.register_opts(opts, group='plugin:%s' % plugin)

        config.parse_configs()

        # register plugin-specific configs
        for plugin_name in CONF.plugins:
            self.plugins[plugin_name] = self._get_plugin_instance(plugin_name)

        config.parse_configs()

        titles = []
        for plugin_name in CONF.plugins:
            plugin = self.plugins[plugin_name]
            plugin.setup(CONF['plugin:%s' % plugin_name])

            title = plugin.get_title()
            if title in titles:
                # replace with specific error
                raise RuntimeError(
                    "Title of plugin '%s' isn't unique" % plugin_name)
            titles.append(title)

            LOG.info("Plugin '%s' defined and loaded" % plugin_name)
Пример #2
0
    def _load_all_plugins(self):
        LOG.debug("List of requested plugins: %s" % CONF.plugins)

        if len(CONF.plugins) > len(set(CONF.plugins)):
            raise RuntimeError("plugins config contains non-unique entries")

        # register required 'plugin_factory' property for each plugin
        for plugin in CONF.plugins:
            opts = [
                cfg.StrOpt('plugin_class', required=True),
            ]
            CONF.register_opts(opts, group='plugin:%s' % plugin)

        config.parse_configs()

        # register plugin-specific configs
        for plugin_name in CONF.plugins:
            self.plugins[plugin_name] = self._get_plugin_instance(plugin_name)

        config.parse_configs()

        titles = []
        for plugin_name in CONF.plugins:
            plugin = self.plugins[plugin_name]
            plugin.setup(CONF['plugin:%s' % plugin_name])

            title = plugin.get_title()
            if title in titles:
                # replace with specific error
                raise RuntimeError("Title of plugin '%s' isn't unique" %
                                   plugin_name)
            titles.append(title)

            LOG.info("Plugin '%s' defined and loaded" % plugin_name)
Пример #3
0
def main():
    dev_conf = os.path.join(possible_topdir, "etc", "savanna", "savanna.conf")
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(sys.argv[1:], config_files)
    logging.setup("savanna")

    if not db_api.setup_db():
        raise RuntimeError("Failed to create database!")

    app = server.make_app()

    wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500), app)
Пример #4
0
def main():
    dev_conf = os.path.join(possible_topdir, 'etc', 'savanna', 'savanna.conf')
    config_files = None
    if os.path.exists(dev_conf):
        config_files = [dev_conf]

    config.parse_configs(sys.argv[1:], config_files)
    logging.setup("savanna")

    if not db_api.setup_db():
        raise RuntimeError('Failed to create database!')

    app = server.make_app()

    wsgi.server(eventlet.listen((cfg.CONF.host, cfg.CONF.port), backlog=500),
                app)