Beispiel #1
0
def serve_health_endpoint(method, path, data):
    if method == 'GET':
        reload = 'reload' in path
        return plugins.get_services_health(reload=reload)
    if method == 'PUT':
        data = json.loads(to_str(data))
        plugins.set_services_health(data)
        return {'status': 'OK'}
Beispiel #2
0
def serve_health_endpoint(method, path, data):
    if method == 'GET':
        reload = 'reload' in path
        return plugins.get_services_health(reload=reload)
    if method == 'PUT':
        data = json.loads(to_str(data or '{}'))
        plugins.set_services_health(data)
        return {'status': 'OK'}
    if method == 'POST':
        data = json.loads(to_str(data or '{}'))
        # backdoor API to support restarting the instance
        if data.get('action') in ['kill', 'restart']:
            terminate_all_processes_in_docker()
    return {}
Beispiel #3
0
def serve_health_endpoint(method, path, data):
    if method == "GET":
        reload = "reload" in path
        return plugins.get_services_health(reload=reload)
    if method == "PUT":
        data = json.loads(to_str(data or "{}"))
        plugins.set_services_health(data)
        return {"status": "OK"}
    if method == "POST":
        data = json.loads(to_str(data or "{}"))
        # backdoor API to support restarting the instance
        if data.get("action") in ["kill", "restart"]:
            terminate_all_processes_in_docker()
    return {}
Beispiel #4
0
def get_health():
    # TODO: this should be moved into a separate service, once the dashboard UI is removed
    reload = request.args.get('reload') is not None
    result = plugins.get_services_health(reload=reload)
    return jsonify(result)