Exemple #1
0
def reinstall(request, cluster_slug, instance):
    new_operating_system = request.POST.get('operating_system', 'none')
    user = request.user
    action = notifyuseradvancedactions(
        user, cluster_slug, instance, action_id=1, action_value=None,
        new_operating_system=new_operating_system)
    return HttpResponse(json.dumps(action))
Exemple #2
0
def rename_instance(
    request,
    cluster_slug,
    instance,
    action_id,
    action_value=None
):
    user = request.user
    form = InstanceRenameForm(request.POST or None)
    if form.is_valid():
        data = form.cleaned_data
        action_value = data['hostname']
        action = notifyuseradvancedactions(
            user,
            cluster_slug,
            instance,
            action_id,
            action_value,
            None
        )
        return HttpResponse(json.dumps(action))
    else:
        return render(
            request,
            'instances/rename_instance.html',
            {
                'form': form,
                'instance': instance,
                'cluster_slug': cluster_slug
            }
        )
Exemple #3
0
def destroy(request, cluster_slug, instance):
    user = request.user
    action = notifyuseradvancedactions(user,
                                       cluster_slug,
                                       instance,
                                       action_id=2,
                                       action_value=None,
                                       new_operating_system=None)
    return HttpResponse(json.dumps(action))
Exemple #4
0
def reinstalldestroy(request,
                     cluster_slug,
                     instance,
                     action_id,
                     action_value=None):
    new_operating_system = request.POST.get('operating_system', 'none') or None
    user = request.user
    action = notifyuseradvancedactions(user, cluster_slug, instance, action_id,
                                       action_value, new_operating_system)
    return HttpResponse(json.dumps(action))
Exemple #5
0
def rename_instance(request, cluster_slug, instance, action_id, action_value=None):
    user = request.user
    form = InstanceRenameForm(request.POST or None)
    if form.is_valid():
        data = form.cleaned_data
        action_value = data["hostname"]
        action = notifyuseradvancedactions(user, cluster_slug, instance, action_id, action_value, None)
        return HttpResponse(json.dumps(action))
    else:
        return render(
            request,
            "instances/rename_instance.html",
            {"form": form, "instance": instance, "cluster_slug": cluster_slug},
        )
Exemple #6
0
def rename_instance(request, cluster_slug, instance):
    user = request.user
    form = InstanceRenameForm(request.POST or None)
    if form.is_valid():
        data = form.cleaned_data
        action = notifyuseradvancedactions(user,
                                           cluster_slug,
                                           instance,
                                           action_id=3,
                                           action_value=data['hostname'],
                                           new_operating_system=None)
        return HttpResponse(json.dumps(action))
    else:
        return render(request, 'instances/rename_instance.html', {
            'form': form,
            'instance': instance,
            'cluster_slug': cluster_slug
        })
Exemple #7
0
def destroy(request, cluster_slug, instance):
    user = request.user
    action = notifyuseradvancedactions(
        user, cluster_slug, instance, action_id=2, action_value=None,
        new_operating_system=None)
    return HttpResponse(json.dumps(action))
Exemple #8
0
def reinstalldestroy(request, cluster_slug, instance, action_id, action_value=None):
    new_operating_system = request.POST.get("operating_system", "none") or None
    user = request.user
    action = notifyuseradvancedactions(user, cluster_slug, instance, action_id, action_value, new_operating_system)
    return HttpResponse(json.dumps(action))