Exemple #1
0
def activate_changes(params):
    """Activate pending changes"""
    body = params["body"]
    sites = body["sites"]
    with may_fail(MKUserError), may_fail(MKAuthException, status=401):
        activation_id = watolib.activate_changes_start(
            sites, force_foreign_changes=body["force_foreign_changes"])

    if body["redirect"]:
        wait_for = _completion_link(activation_id)
        response = Response(status=302)
        response.location = wait_for["href"]
        return response

    return _serve_activation_run(activation_id, is_running=True)
Exemple #2
0
def link_with_uuid(params) -> Response:
    """Link a host to a UUID"""
    with may_fail(MKAuthException):
        host = _check_host_editing_permissions(host_name := params["host_name"])
    _link_with_uuid(
        host_name,
        host,
        params["body"]["uuid"],
    )
    return Response(status=204)
Exemple #3
0
def activate_changes(params):
    """Activate pending changes"""
    body = params['body']
    sites = body['sites']
    with may_fail(MKUserError, status=400):
        activation_id = watolib.activate_changes_start(sites)
    if body['redirect']:
        wait_for = _completion_link(activation_id)
        response = Response(status=301)
        response.location = wait_for['href']
        return response

    return _serve_activation_run(activation_id, is_running=True)