mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-05-26 15:13:33 +00:00
reorg imports and black format
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
from rest_framework import serializers
|
||||
from computes.models import Compute
|
||||
from vrtManager.connection import (
|
||||
CONN_SOCKET,
|
||||
CONN_SSH,
|
||||
CONN_TCP,
|
||||
CONN_TLS,
|
||||
)
|
||||
from rest_framework import serializers
|
||||
from vrtManager.connection import CONN_SOCKET, CONN_SSH, CONN_TCP, CONN_TLS
|
||||
|
||||
|
||||
class ComputeSerializer(serializers.ModelSerializer):
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from computes.models import Compute
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import permissions
|
||||
|
||||
from vrtManager.create import wvmCreate
|
||||
from .serializers import ComputeSerializer
|
||||
from rest_framework import permissions, viewsets
|
||||
from rest_framework.response import Response
|
||||
from vrtManager.create import wvmCreate
|
||||
|
||||
from .serializers import ComputeSerializer
|
||||
|
||||
|
||||
class ComputeViewSet(viewsets.ModelViewSet):
|
||||
|
||||
@@ -12,4 +12,6 @@ def refresh_instance_database(compute):
|
||||
names = Instance.objects.filter(compute=compute).values_list("name", flat=True)
|
||||
for domain in domains:
|
||||
if domain.name() not in names:
|
||||
Instance( compute=compute, name=domain.name(), uuid=domain.UUIDString()).save()
|
||||
Instance(
|
||||
compute=compute, name=domain.name(), uuid=domain.UUIDString()
|
||||
).save()
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import json
|
||||
|
||||
from admin.decorators import superuser_only
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from libvirt import libvirtError
|
||||
|
||||
from admin.decorators import superuser_only
|
||||
from computes.forms import (
|
||||
SocketComputeForm,
|
||||
SshComputeForm,
|
||||
TcpComputeForm,
|
||||
TlsComputeForm,
|
||||
)
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
from libvirt import libvirtError
|
||||
from vrtManager.connection import (
|
||||
CONN_SOCKET,
|
||||
CONN_SSH,
|
||||
@@ -25,6 +17,14 @@ from vrtManager.connection import (
|
||||
)
|
||||
from vrtManager.hostdetails import wvmHostDetails
|
||||
|
||||
from computes.forms import (
|
||||
SocketComputeForm,
|
||||
SshComputeForm,
|
||||
TcpComputeForm,
|
||||
TlsComputeForm,
|
||||
)
|
||||
from computes.models import Compute
|
||||
|
||||
from . import utils
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ def overview(request, compute_id):
|
||||
compute = get_object_or_404(Compute, pk=compute_id)
|
||||
status = (
|
||||
"true"
|
||||
if connection_manager.host_is_up(compute.type, compute.hostname) is True else "false"
|
||||
if connection_manager.host_is_up(compute.type, compute.hostname) is True
|
||||
else "false"
|
||||
)
|
||||
|
||||
conn = wvmHostDetails(
|
||||
@@ -82,9 +83,7 @@ def instances(request, compute_id):
|
||||
)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"computes/instances.html",
|
||||
{"compute": compute, "instances": instances}
|
||||
request, "computes/instances.html", {"compute": compute, "instances": instances}
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user