Пример #1
0
def get_connection(name, config, scale_manager):
    if name == "none" or name == "":
        return LoadBalancerConnection(name, scale_manager, config)

    lb_config = LoadBalancerConfig(config)
    lb_class = lb_config.loadbalancer_class()
    if lb_class == '':
        lb_class = "reactor.loadbalancer.%s.Connection" % (name)

    try:
        lb_conn_class = utils.import_class(lb_class)
        return lb_conn_class(name, scale_manager, config)
    except:
        logging.error("Unable to load loadbalancer: %s" % traceback.format_exc())
        return LoadBalancerConnection(name, scale_manager, config)
Пример #2
0
def get_connection(cloud_type, config):
    if cloud_type == 'none':
        return CloudConnection(config)

    cloud_config = CloudConnectionConfig(config)
    cloud_class = cloud_config.cloud_class()
    if cloud_class == '':
        cloud_class = "reactor.cloud.%s.Connection" % (cloud_type)

    try:
        cloud_conn_class = utils.import_class(cloud_class)
        return cloud_conn_class(config)
    except:
        logging.error("Unable to load cloud: %s" % traceback.format_exc())
        return CloudConnection(config)
Пример #3
0
def get_connection(name, **kwargs):
    if not name:
        return LoadBalancerConnection(name=name, **kwargs)
    lb_class = "reactor.loadbalancer.%s.connection.Connection" % name
    lb_conn_class = utils.import_class(lb_class)
    return lb_conn_class(name=name, **kwargs)
Пример #4
0
def get_connection(name, **kwargs):
    if not name:
        return CloudConnection(name, **kwargs)
    cloud_class = "reactor.cloud.%s.connection.Connection" % name
    cloud_conn_class = utils.import_class(cloud_class)
    return cloud_conn_class(name, **kwargs)
Пример #5
0
def get_connection(name, **kwargs):
    if not name:
        return CloudConnection(name, **kwargs)
    cloud_class = "reactor.cloud.%s.connection.Connection" % name
    cloud_conn_class = utils.import_class(cloud_class)
    return cloud_conn_class(name, **kwargs)