示例#1
0
文件: server.py 项目: k0nserv/flyby
def deregister_backend(service_name, target_group_name, host):
    try:
        Service.deregister_backend(service_name, target_group_name, host)
    except Service.DoesNotExist:
        return 'Backend: {} for target group: {} in service: {}' \
               ' not currently registered with Flyby.'.format(host, target_group_name, service_name), 404
    return 'OK'
示例#2
0
文件: server.py 项目: k0nserv/flyby
def delete_service(service_name, target_group_name):
    try:
        Service.deregister_target_group(service_name, target_group_name)
    except Service.DoesNotExist:
        return 'Target group: {} for service: {} not currently registered with Flyby.'.format(
            target_group_name, service_name), 404
    return 'OK'
示例#3
0
文件: server.py 项目: k0nserv/flyby
def deregister_service(service_name):
    try:
        Service.deregister_service(service_name)
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
    return 'OK'
示例#4
0
文件: server.py 项目: k0nserv/flyby
def deregister_resolver(resolver_name):
    try:
        Service.deregister_resolver(resolver_name)
        return 'OK'
    except Service.DoesNotExist:
        return 'Resolver: {} not currently registered with Flyby.'.format(
            resolver_name), 404
示例#5
0
文件: cli.py 项目: k0nserv/flyby
def update(fqdn):
    logger.debug("Started job...")
    try:
        start_time = time.time()
        resolvers = Service.query_resolvers()
        services = Service.query_services()
        Haproxy().update(fqdn=fqdn, resolvers=resolvers, services=services)
        metrics.info('background-refresh.duration {}'.format(time.time() - start_time))
        metrics.info('active-thread-count {}'.format(threading.active_count()))
    finally:
        logger.debug("Finished job.")
示例#6
0
文件: server.py 项目: k0nserv/flyby
def register_target_group():
    try:
        return flask.jsonify(
            Service.register_target_group(flask.request.get_json(force=True)))
    except Service.DoesNotExist as e:
        return 'Service: {} not currently registered with Flyby.'.format(
            e.args[0]), 404
示例#7
0
文件: server.py 项目: k0nserv/flyby
def update_service(service_name):
    try:
        data = Service.update_service(service_name,
                                      flask.request.get_json(force=True))
        return flask.jsonify(data)
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
示例#8
0
文件: server.py 项目: k0nserv/flyby
def register_dns_resolver():
    data = Service.register_resolver(flask.request.get_json(force=True))
    return flask.jsonify(data)
示例#9
0
文件: server.py 项目: k0nserv/flyby
def register_backend():
    try:
        return flask.jsonify(
            Service.register_backend(flask.request.get_json(force=True)))
    except Service.DoesNotExist as e:
        return "{} does not exist.".format(e.args[0]), 404
示例#10
0
文件: server.py 项目: k0nserv/flyby
def describe_service(service_name):
    try:
        return flask.jsonify(Service.describe_service(service_name))
    except Service.DoesNotExist:
        return 'Service: {} not currently registered with Flyby.'.format(
            service_name), 404
示例#11
0
文件: server.py 项目: k0nserv/flyby
def query_services():
    return flask.jsonify({'services': Service.query_services()})
示例#12
0
文件: server.py 项目: k0nserv/flyby
def register_service():
    data = Service.register_service(flask.request.get_json(force=True))
    return flask.jsonify(data)
示例#13
0
文件: server.py 项目: k0nserv/flyby
def describe_resolver(resolver_name):
    try:
        return flask.jsonify(Service.describe_resolver(resolver_name))
    except Service.DoesNotExist:
        return 'Resolver: {} not currently registered with Flyby.'.format(
            resolver_name), 404
示例#14
0
文件: server.py 项目: k0nserv/flyby
def query_resolvers():
    return flask.jsonify({'resolvers': Service.query_resolvers()})