Beispiel #1
0
    def _load_providers(self):
        """load provider"""
        config_dir = utils.find_config(CONF.provider_config_dir)

        for config_file in os.listdir(config_dir):
            if not config_file.endswith('.conf'):
                continue
            config_path = os.path.abspath(os.path.join(config_dir,
                                                       config_file))
            provider_config = cfg.ConfigOpts()
            provider_config(args=['--config-file=' + config_path])
            provider_config.register_opts(provider_opts, 'provider')

            provider_enabled = provider_config.provider.enabled
            if not provider_enabled:
                LOG.info('Provider {0} is not enabled'.format(
                    provider_config.provider.name)
                )
                continue

            try:
                provider = PluggableProtectionProvider(provider_config)
            except Exception as e:
                LOG.error("Load provider: %(provider)s failed. "
                          "Reason: %(reason)s",
                          {'provider': provider_config.provider.name,
                           'reason': e})
            else:
                LOG.info('Loaded provider: %s successfully.',
                         provider_config.provider.name)
                self.providers[provider.id] = provider
Beispiel #2
0
    def __init__(self, config_path=None):
        """Initialize the loader, and attempt to find the config.

        :param config_path: Full or relative path to the paste config.
        :returns: None

        """
        config_path = config_path or CONF.api_paste_config
        self.config_path = utils.find_config(config_path)
Beispiel #3
0
    def __init__(self, config_path=None):
        """Initialize the loader, and attempt to find the config.

        :param config_path: Full or relative path to the paste config.
        :returns: None

        """
        config_path = config_path or CONF.api_paste_config
        self.config_path = utils.find_config(config_path)
Beispiel #4
0
def create(context, conf):
    config_dir = utils.find_config(CONF.provider_config_dir)
    config_file = os.path.abspath(os.path.join(config_dir, 'eisoo.conf'))
    config = cfg.ConfigOpts()
    config(args=['--config-file=' + config_file])
    config.register_opts(eisoo_client_opts, group=SERVICE + '_client')

    LOG.info('Creating eisoo client with url %s.',
             config.eisoo_client.eisoo_endpoint)
    abclient = client.ABClient(config.eisoo_client.eisoo_endpoint,
                               config.eisoo_client.eisoo_app_id,
                               config.eisoo_client.eisoo_app_secret)

    return abclient
Beispiel #5
0
def create(context, conf):
    config_dir = utils.find_config(CONF.provider_config_dir)
    config_file = os.path.abspath(os.path.join(config_dir,
                                               'eisoo.conf'))
    config = cfg.ConfigOpts()
    config(args=['--config-file=' + config_file])
    config.register_opts(eisoo_client_opts,
                         group=SERVICE + '_client')

    LOG.info(_LI('Creating eisoo client with url %s.'),
             config.eisoo_client.eisoo_endpoint)
    abclient = client.ABClient(config.eisoo_client.eisoo_endpoint,
                               config.eisoo_client.eisoo_app_id,
                               config.eisoo_client.eisoo_app_secret)

    return abclient
Beispiel #6
0
    def _load_providers(self):
        """load provider"""
        config_dir = utils.find_config(CONF.provider_config_dir)

        for config_file in os.listdir(config_dir):
            if not config_file.endswith('.conf'):
                continue
            config_path = os.path.abspath(os.path.join(config_dir,
                                                       config_file))
            provider_config = cfg.ConfigOpts()
            provider_config(args=['--config-file=' + config_path])
            provider_config.register_opts(provider_opts, 'provider')
            try:
                provider = PluggableProtectionProvider(provider_config)
            except Exception as e:
                LOG.error(_LE("Load provider: %(provider)s failed. "
                              "Reason: %(reason)s"),
                          {'provider': provider_config.provider.name,
                           'reason': e})
            else:
                self.providers[provider.id] = provider
Beispiel #7
0
    def _load_providers(self):
        """load provider"""
        config_dir = utils.find_config(CONF.provider_config_dir)

        for config_file in os.listdir(config_dir):
            if not config_file.endswith('.conf'):
                continue
            config_path = os.path.abspath(os.path.join(config_dir,
                                                       config_file))
            provider_config = cfg.ConfigOpts()
            provider_config(args=['--config-file=' + config_path])
            provider_config.register_opts(provider_opts, 'provider')
            try:
                provider = PluggableProtectionProvider(provider_config)
            except Exception as e:
                LOG.error(
                    _LE("Load provider: %(provider)s failed. "
                        "Reason: %(reason)s"), {
                            'provider': provider_config.provider.name,
                            'reason': e
                        })
            else:
                self.providers[provider.id] = provider