Example #1
0
 def _start():
     MODULES.register(MjCastServerModule())
Example #2
0
 def _start():
     MODULES.register(JobModule())
Example #3
0
 def _start():
     MODULES.register(MetricsModule())
Example #4
0
 def _start():
     MODULES.register(ProbesModule())
Example #5
0
 def _start():
     MODULES.register(ReplayModule())
Example #6
0
def load_conf(xfile, options=None):
    signal.signal(signal.SIGTERM, stop)
    signal.signal(signal.SIGINT, stop)

    config_dir = os.path.dirname(os.path.abspath(xfile))

    with open(xfile, 'r') as f:
        conf = parse_conf(load_yaml(f))

    for name, module in MODULES.iteritems():
        LOG.info("module init: %r", name)
        module.init(conf)

    for x in ('module', 'plugin'):
        path = conf['general'].get('%ss_path' % x)
        if path and os.path.isdir(path):
            DwhoLibLoader.load_dir(x, path)

    if not conf.get('endpoints'):
        raise FdReplayConfigurationError(
            "Missing 'endpoints' section in configuration")

    for name, ept_cfg in conf['endpoints'].iteritems():
        cfg = {
            'general': dict(conf['general']),
            'fd-replay': {
                'endpoint_name': name,
                'config_dir': config_dir
            },
            'vars': {},
            'config': {}
        }

        if 'plugin' not in ept_cfg:
            raise FdReplayConfigurationError(
                "Missing 'plugin' option in endpoint: %r" % name)

        if ept_cfg['plugin'] not in PLUGINS:
            raise FdReplayConfigurationError(
                "Invalid plugin %r in endpoint: %r" %
                (ept_cfg['plugin'], name))
        cfg['fd-replay']['plugin_name'] = ept_cfg['plugin']

        for x in ('config', 'vars'):
            if ept_cfg.get("import_%s" % x):
                cfg[x].update(
                    import_file(ept_cfg["import_%s" % x], config_dir, cfg))

            if x in ept_cfg:
                cfg[x].update(dict(ept_cfg[x]))

        cfg['credentials'] = None
        if ept_cfg.get('credentials'):
            cfg['credentials'] = ept_cfg['credentials']

        endpoint = PLUGINS[ept_cfg['plugin']](name)
        ENDPOINTS.register(endpoint)
        LOG.info("endpoint init: %r", name)
        endpoint.init(cfg)
        LOG.info("endpoint safe_init: %r", name)
        endpoint.safe_init()
        DWHO_THREADS.append(endpoint.at_stop)

    if not options or not isinstance(options, object):
        return conf

    for def_option in get_default_options().iterkeys():
        if getattr(options, def_option, None) is None \
           and def_option in conf['general']:
            setattr(options, def_option, conf['general'][def_option])

    setattr(options, 'configuration', conf)

    return options
Example #7
0
 def _start():
     MODULES.register(PDNSModule())
Example #8
0
 def _start():
     MODULES.register(DWhoModuleWeb())
Example #9
0
 def _start():
     MODULES.register(BotbondServerModule())