예제 #1
0
    def add_source(self, name, config, auth_config):
        LOG.info(config)
        rest_config = Configuration()
        rest_config.url_base = config.get('url', None)
        rest_config.accept = config.get('data_type', 'application/json')
        if config.auth == 'noauth':
            rest_config.auth_handler = 'None'
        else:
            auth = auth_config[config.auth]
            rest_config.auth_handler = auth.auth_handler
            rest_config.auth_handler_conf = Configuration(
                auth.get('auth_handler_conf', {}))

        content_type = getattr(WebReplicaLock, config.content_type)
        site_pattern = config.get('sites', None)
        lock_url = config.get('lock_url', None)

        if rest_config.url_base is not None:
            self._sources[name] = (webservice.RESTService(rest_config),
                                   content_type, site_pattern, lock_url)

        if config.get('oracledb', None) is not None:
            oracle_config = Configuration()
            oracle_config.db = config.oracledb.db
            oracle_config.pw = config.oracledb.password
            oracle_config.host = config.oracledb.host
            self._sources[name] = (webservice.OracleService(oracle_config),
                                   content_type, site_pattern,
                                   (config.oracledb.lockoflock,
                                    config.oracledb.locks))
예제 #2
0
    def add_source(self, name, config, auth_config):
        rest_config = Configuration()
        rest_config.url_base = config.url
        rest_config.accept = config.get('data_type', 'application/json')
        if config.auth == 'noauth':
            rest_config.auth_handler = 'None'
        else:
            auth = auth_config[config.auth]
            rest_config.auth_handler = auth.auth_handler
            rest_config.auth_handler_conf = Configuration(
                auth.get('auth_handler_conf', {}))

        content_type = getattr(WebReplicaLock, config.content_type)
        site_pattern = config.get('sites', None)
        lock_url = config.get('lock_url', None)

        self._sources[name] = (webservice.RESTService(rest_config),
                               content_type, site_pattern, lock_url)
예제 #3
0
    def __init__(self, config=None):
        config = Configuration(config)

        config.auth_handler = 'HTTPSCertKeyHandler'
        if 'url_base' not in config:
            config.url_base = DBS._url_base
        if 'num_attempts' not in config:
            config.num_attempts = DBS._num_attempts

        RESTService.__init__(self, config)