mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
reorg imports and black format
This commit is contained in:
parent
fcd4b79431
commit
a1eab70e2d
27 changed files with 319 additions and 305 deletions
|
|
@ -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}
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue