mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-05 18:21:05 +03:00
style: sort imports in compute, db and services modules
This commit is contained in:
parent
38e9ddca09
commit
b9cdac487c
@ -14,15 +14,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .builtin import Builtin
|
||||
from .vpcs import VPCS
|
||||
from .virtualbox import VirtualBox
|
||||
from .dynamips import Dynamips
|
||||
from .qemu import Qemu
|
||||
from .virtualbox import VirtualBox
|
||||
from .vmware import VMware
|
||||
from .vpcs import VPCS
|
||||
|
||||
MODULES = [Builtin, VPCS, VirtualBox, Dynamips, Qemu, VMware]
|
||||
|
||||
|
||||
@ -14,37 +14,38 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import struct
|
||||
import stat
|
||||
import asyncio
|
||||
import aiofiles
|
||||
import socket
|
||||
import shutil
|
||||
import re
|
||||
import logging
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import stat
|
||||
import struct
|
||||
import sys
|
||||
|
||||
import aiofiles
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from gns3server.utils.asyncio import cancellable_wait_run_in_executor
|
||||
from typing import Type
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError, ComputeForbiddenError, ComputeNotFoundError
|
||||
from gns3server.utils.asyncio import cancellable_wait_run_in_executor
|
||||
from gns3server.utils.interfaces import is_interface_up
|
||||
|
||||
from uuid import UUID, uuid4
|
||||
from typing import Type
|
||||
from ..config import Config
|
||||
from ..utils import force_unix_path
|
||||
from .project_manager import ProjectManager
|
||||
from .port_manager import PortManager
|
||||
from ..utils.images import default_images_directory, images_directories, list_images, md5sum, remove_checksum
|
||||
from .base_node import BaseNode
|
||||
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .nios.nio_tap import NIOTAP
|
||||
from .error import ImageMissingError, NodeError
|
||||
from .nios.nio_ethernet import NIOEthernet
|
||||
from ..utils.images import md5sum, remove_checksum, images_directories, default_images_directory, list_images
|
||||
from .error import NodeError, ImageMissingError
|
||||
from .nios.nio_tap import NIOTAP
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .port_manager import PortManager
|
||||
from .project_manager import ProjectManager
|
||||
|
||||
CHUNK_SIZE = 1024 * 8 # 8KB
|
||||
|
||||
|
||||
@ -14,33 +14,34 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import stat
|
||||
import shutil
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
import struct
|
||||
import tempfile
|
||||
import psutil
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import asyncssh
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import asyncssh
|
||||
import psutil
|
||||
from fastapi import WebSocketDisconnect
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError
|
||||
from ..compute.port_manager import PortManager
|
||||
from ..utils.asyncio import wait_run_in_executor, locking
|
||||
from ..utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from ..utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.compute.ubridge.hypervisor import Hypervisor
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .error import NodeError
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
|
||||
import logging
|
||||
from ..compute.port_manager import PortManager
|
||||
from ..utils.asyncio import locking, wait_run_in_executor
|
||||
from ..utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from ..utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from .error import NodeError
|
||||
from .nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
Builtin nodes server module.
|
||||
"""
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .builtin_node_factory import BuiltinNodeFactory, BUILTIN_NODES
|
||||
|
||||
import logging
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .builtin_node_factory import BUILTIN_NODES, BuiltinNodeFactory
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from ..error import NodeError
|
||||
from .nodes.cloud import Cloud
|
||||
from .nodes.nat import Nat
|
||||
from .nodes.ethernet_hub import EthernetHub
|
||||
from .nodes.ethernet_switch import EthernetSwitch
|
||||
|
||||
import logging
|
||||
from .nodes.nat import Nat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,18 +14,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from ...error import NodeError
|
||||
from ...base_node import BaseNode
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
import gns3server.utils.asyncio
|
||||
import gns3server.utils.interfaces
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
import gns3server.utils.interfaces
|
||||
import gns3server.utils.asyncio
|
||||
|
||||
import logging
|
||||
from ...base_node import BaseNode
|
||||
from ...error import NodeError
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,11 +15,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ...base_node import BaseNode
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -37,12 +37,13 @@ be the switch). ESW ``access``/``dot1q``/``qinq`` port modes are composed from
|
||||
the ``brctl`` VLAN primitives here -- see ``_apply_port_vlan``.
|
||||
"""
|
||||
|
||||
from ...base_node import BaseNode
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
from ...error import NodeError
|
||||
import logging
|
||||
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
import logging
|
||||
from ...base_node import BaseNode
|
||||
from ...error import NodeError
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,15 +15,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from .cloud import Cloud
|
||||
from ...error import NodeError
|
||||
|
||||
import gns3server.utils.interfaces
|
||||
from gns3server.config import Config
|
||||
|
||||
import logging
|
||||
from ...error import NodeError
|
||||
from .cloud import Cloud
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,13 +14,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import socket
|
||||
import ipaddress
|
||||
import threading
|
||||
from fastapi import HTTPException, status
|
||||
from gns3server.config import Config
|
||||
|
||||
import logging
|
||||
import socket
|
||||
import threading
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
from gns3server.config import Config
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,24 +14,24 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import datetime
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import magic
|
||||
import asyncio
|
||||
import hashlib
|
||||
import datetime
|
||||
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
import magic
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError, ComputeNotFoundError, ComputeForbiddenError
|
||||
from .port_manager import PortManager
|
||||
from .notification_manager import NotificationManager
|
||||
from gns3server.compute.compute_error import ComputeError, ComputeForbiddenError, ComputeNotFoundError
|
||||
|
||||
from ..config import Config
|
||||
from ..utils.asyncio import wait_run_in_executor
|
||||
from ..utils.path import check_path_allowed, get_default_project_directory
|
||||
|
||||
import logging
|
||||
from .notification_manager import NotificationManager
|
||||
from .port_manager import PortManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,19 +18,19 @@
|
||||
VirtualBox server module.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import shutil
|
||||
import asyncio
|
||||
import subprocess
|
||||
import logging
|
||||
import sys
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .virtualbox_vm import VirtualBoxVM
|
||||
from .virtualbox_error import VirtualBoxError
|
||||
from .virtualbox_vm import VirtualBoxVM
|
||||
|
||||
|
||||
class VirtualBox(BaseManager):
|
||||
|
||||
@ -18,28 +18,27 @@
|
||||
VirtualBox VM instance.
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import asyncio
|
||||
import json
|
||||
import uuid
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
import asyncio
|
||||
import sys
|
||||
import tempfile
|
||||
import uuid
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.utils.asyncio.serial import asyncio_open_serial
|
||||
from gns3server.utils.asyncio import locking
|
||||
from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from gns3server.compute.nios.nio_udp import NIOUDP
|
||||
from gns3server.compute.adapters.ethernet_adapter import EthernetAdapter
|
||||
from gns3server.compute.base_node import BaseNode
|
||||
|
||||
import logging
|
||||
from gns3server.compute.nios.nio_udp import NIOUDP
|
||||
from gns3server.compute.virtualbox.virtualbox_error import VirtualBoxError
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import locking
|
||||
from gns3server.utils.asyncio.serial import asyncio_open_serial
|
||||
from gns3server.utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,27 +18,27 @@
|
||||
VMware player/workstation server module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import shutil
|
||||
import asyncio
|
||||
import subprocess
|
||||
import logging
|
||||
import codecs
|
||||
import ipaddress
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.utils.asyncio import subprocess_check_output
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import subprocess_check_output
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.compute.vmware.vmware_vm import VMwareVM
|
||||
from gns3server.compute.vmware.vmware_error import VMwareError
|
||||
from gns3server.compute.vmware.vmware_vm import VMwareVM
|
||||
|
||||
|
||||
class VMware(BaseManager):
|
||||
|
||||
@ -18,25 +18,24 @@
|
||||
VMware VM instance.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import asyncio
|
||||
import tempfile
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import tempfile
|
||||
from collections import OrderedDict
|
||||
|
||||
from gns3server.utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.utils.asyncio.serial import asyncio_open_serial
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import locking
|
||||
from collections import OrderedDict
|
||||
from .vmware_error import VMwareError
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
from gns3server.utils.asyncio.serial import asyncio_open_serial
|
||||
from gns3server.utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from gns3server.utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
|
||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||
from ..base_node import BaseNode
|
||||
|
||||
|
||||
import logging
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
from .vmware_error import VMwareError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
VPCS server module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .vpcs_error import VPCSError
|
||||
|
||||
@ -19,27 +19,23 @@ VPCS VM management (creates command line, processes, files etc.) in
|
||||
order to run a VPCS VM.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import signal
|
||||
import re
|
||||
import asyncio
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from gns3server.utils.asyncio import wait_for_process_termination
|
||||
from gns3server.utils.asyncio import monitor_process
|
||||
from gns3server.utils.asyncio import subprocess_check_output
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import monitor_process, subprocess_check_output, wait_for_process_termination
|
||||
|
||||
from .vpcs_error import VPCSError
|
||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
from ..base_node import BaseNode
|
||||
|
||||
|
||||
import logging
|
||||
from ..nios.nio_udp import NIOUDP
|
||||
from .vpcs_error import VPCSError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,18 +15,16 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .base import Base
|
||||
from .acl import ACE
|
||||
from .users import User, UserGroup
|
||||
from .roles import Role
|
||||
from .privileges import Privilege
|
||||
from .api_keys import ApiKey
|
||||
from .base import Base
|
||||
from .computes import Compute
|
||||
from .images import Image, ImageSyncJob
|
||||
from .pools import Resource, ResourcePool
|
||||
from .llm_model_configs import LLMModelConfig
|
||||
from .api_keys import ApiKey
|
||||
from .pools import Resource, ResourcePool
|
||||
from .privileges import Privilege
|
||||
from .roles import Role
|
||||
from .templates import (
|
||||
Template,
|
||||
CloudTemplate,
|
||||
DockerTemplate,
|
||||
DynamipsTemplate,
|
||||
@ -34,7 +32,9 @@ from .templates import (
|
||||
EthernetSwitchTemplate,
|
||||
IOUTemplate,
|
||||
QemuTemplate,
|
||||
Template,
|
||||
VirtualBoxTemplate,
|
||||
VMwareTemplate,
|
||||
VPCSTemplate,
|
||||
)
|
||||
from .users import User, UserGroup
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sqlalchemy import Column, String, Boolean, ForeignKey, CheckConstraint
|
||||
import logging
|
||||
|
||||
from sqlalchemy import Boolean, CheckConstraint, Column, ForeignKey, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .base import BaseTable, generate_uuid, GUID
|
||||
|
||||
import logging
|
||||
from .base import GUID, BaseTable, generate_uuid
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, String, Boolean, DateTime, ForeignKey, func
|
||||
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, String, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from .base import BaseTable, GUID
|
||||
from .base import GUID, BaseTable
|
||||
|
||||
|
||||
class ApiKey(BaseTable):
|
||||
|
||||
@ -21,9 +21,9 @@ from typing import Optional
|
||||
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from sqlalchemy import Column, DateTime, func, inspect
|
||||
from sqlalchemy.types import TypeDecorator, CHAR, VARCHAR
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
from sqlalchemy.types import CHAR, VARCHAR, TypeDecorator
|
||||
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sqlalchemy import Column, String, Integer
|
||||
from sqlalchemy import Column, Integer, String
|
||||
|
||||
from .base import BaseTable, GUID
|
||||
from .base import GUID, BaseTable
|
||||
|
||||
|
||||
class Compute(BaseTable):
|
||||
|
||||
@ -15,11 +15,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sqlalchemy import Table, Column, String, ForeignKey, BigInteger, Integer, DateTime, JSON, Boolean
|
||||
from sqlalchemy import JSON, BigInteger, Boolean, Column, DateTime, ForeignKey, Integer, String, Table
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import Base, BaseTable, GUID
|
||||
|
||||
from .base import GUID, Base, BaseTable
|
||||
|
||||
image_template_map = Table(
|
||||
"image_template_map",
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sqlalchemy import Column, Boolean, ForeignKey, CheckConstraint, Index, Integer, String, text, JSON
|
||||
import logging
|
||||
|
||||
from sqlalchemy import JSON, Boolean, CheckConstraint, Column, ForeignKey, Index, Integer, String, text
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import BaseTable, generate_uuid, GUID
|
||||
|
||||
import logging
|
||||
from .base import GUID, BaseTable, generate_uuid
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,14 +15,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Table, Column, String, ForeignKey
|
||||
from sqlalchemy import Column, ForeignKey, String, Table
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import Base, BaseTable, generate_uuid, GUID
|
||||
|
||||
import logging
|
||||
from .base import GUID, Base, BaseTable, generate_uuid
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from sqlalchemy import Table, Column, String, ForeignKey, event
|
||||
import logging
|
||||
|
||||
from sqlalchemy import Column, ForeignKey, String, Table, event
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .base import Base, BaseTable, generate_uuid, GUID
|
||||
|
||||
import logging
|
||||
from .base import GUID, Base, BaseTable, generate_uuid
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,16 +15,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, String, Boolean, event
|
||||
from sqlalchemy import Boolean, Column, String, event
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import BaseTable, generate_uuid, GUID
|
||||
from .base import GUID, BaseTable, generate_uuid
|
||||
from .privileges import privilege_role_map
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Boolean, Column, String, Integer, Float, ForeignKey, JSON
|
||||
from sqlalchemy import JSON, Boolean, Column, Float, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import BaseTable, generate_uuid, GUID
|
||||
from .base import GUID, BaseTable, generate_uuid
|
||||
from .images import image_template_map
|
||||
|
||||
|
||||
|
||||
@ -15,19 +15,18 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Table, Boolean, Column, Integer, String, DateTime, ForeignKey, event
|
||||
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, Table, event
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import Base, BaseTable, generate_uuid, GUID
|
||||
|
||||
from gns3server.config import Config
|
||||
from gns3server.services import auth_service
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
from .base import GUID, Base, BaseTable, generate_uuid
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,18 +14,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from uuid import UUID
|
||||
from typing import Optional, List, cast
|
||||
import logging
|
||||
from datetime import datetime, timezone
|
||||
from sqlalchemy import select, update, delete, func
|
||||
from typing import List, Optional, cast
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import delete, func, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from .base import BaseRepository
|
||||
import gns3server.db.models as models
|
||||
|
||||
import logging
|
||||
from .base import BaseRepository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,18 +15,18 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import List, Optional, Union, cast
|
||||
from uuid import UUID
|
||||
from typing import Optional, List, Union
|
||||
from sqlalchemy import select, update, delete
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from typing import cast
|
||||
|
||||
from .base import BaseRepository
|
||||
from sqlalchemy import delete, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
|
||||
class ComputesRepository(BaseRepository):
|
||||
def __init__(self, db_session: AsyncSession) -> None:
|
||||
|
||||
@ -15,23 +15,22 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime, timezone
|
||||
from typing import Callable, List, Optional, cast
|
||||
|
||||
from typing import Optional, List, Callable, cast
|
||||
from sqlalchemy import select, delete, update
|
||||
from sqlalchemy import delete, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server.utils.image_inventory import fingerprint, image_lock, normalized_path
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
import gns3server.db.models as models
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -73,7 +72,7 @@ class ImagesRepository(BaseRepository):
|
||||
|
||||
async def is_usable(self, image: models.Image) -> bool:
|
||||
"""Validate a checksum candidate without trusting stale catalog/sidecar data."""
|
||||
from gns3server.utils.images import inspect_image_file, InvalidImageError
|
||||
from gns3server.utils.images import InvalidImageError, inspect_image_file
|
||||
|
||||
try:
|
||||
current = await asyncio.to_thread(fingerprint, image.path)
|
||||
|
||||
@ -15,16 +15,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from uuid import UUID
|
||||
from typing import Optional, List, Dict, Any, cast
|
||||
from sqlalchemy import select, update, delete, and_
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from datetime import datetime
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, cast
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import and_, delete, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
|
||||
import gns3server.db.models as models
|
||||
|
||||
from .base import BaseRepository
|
||||
import gns3server.db.models as models
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,19 +15,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from typing import List, Optional, Union, cast
|
||||
from uuid import UUID
|
||||
from typing import Optional, List, Union, cast
|
||||
from sqlalchemy import select, update, delete
|
||||
|
||||
from sqlalchemy import delete, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
|
||||
import logging
|
||||
from .base import BaseRepository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,20 +15,20 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from uuid import UUID
|
||||
import logging
|
||||
from typing import List, Optional, Union, cast
|
||||
from urllib.parse import urlparse
|
||||
from typing import Optional, List, Union, cast
|
||||
from sqlalchemy import select, update, delete
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import delete, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
|
||||
import logging
|
||||
from .base import BaseRepository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,25 +15,25 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import uuid
|
||||
import logging
|
||||
|
||||
from typing import List, Optional, Union, cast
|
||||
from uuid import UUID
|
||||
from typing import List, Union, Optional, cast
|
||||
from sqlalchemy import select, delete
|
||||
|
||||
from sqlalchemy import delete, select
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
from sqlalchemy.orm.session import make_transient
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.utils.image_inventory import image_lock
|
||||
from gns3server.controller.controller_error import ControllerNotFoundError
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
TEMPLATE_TYPE_TO_MODEL = {
|
||||
|
||||
@ -15,20 +15,20 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
from typing import List, Optional, Union, cast
|
||||
from uuid import UUID
|
||||
from typing import Optional, List, Union, cast
|
||||
from sqlalchemy import select, update, delete, func
|
||||
|
||||
from sqlalchemy import delete, func, select, update
|
||||
from sqlalchemy.engine import CursorResult
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from .base import BaseRepository
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.services import auth_service
|
||||
|
||||
import logging
|
||||
from .base import BaseRepository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,30 +15,29 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import os
|
||||
from typing import List, Optional
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import command, config
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from alembic.script import ScriptDirectory
|
||||
from alembic.util.exc import CommandError
|
||||
from fastapi import FastAPI
|
||||
from pydantic import ValidationError
|
||||
from typing import List, Optional
|
||||
from sqlalchemy import event
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||||
from alembic import command, config
|
||||
from alembic.script import ScriptDirectory
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from alembic.util.exc import CommandError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.config import Config
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.utils.images import read_image_info
|
||||
from gns3server import schemas
|
||||
|
||||
from .models import Base
|
||||
from gns3server.config import Config
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -141,6 +140,7 @@ async def connect_to_db(app: FastAPI) -> None:
|
||||
# Ensure the additive schema before stamping the current head.
|
||||
def upgrade_inventory(connection):
|
||||
from alembic.operations import Operations
|
||||
|
||||
from gns3server.db_migrations.versions.d9e8a2b7c401_image_inventory_reconciliation import (
|
||||
upgrade,
|
||||
)
|
||||
@ -230,6 +230,7 @@ async def get_user_llm_config_full(user_id: str, app: FastAPI) -> Optional[dict]
|
||||
or None if not found.
|
||||
"""
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.db.repositories.llm_model_configs import LLMModelConfigsRepository
|
||||
from gns3server.utils.encryption import decrypt, is_encrypted
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .authentication import AuthService
|
||||
from .access_tickets import AccessTicketService
|
||||
from .authentication import AuthService
|
||||
|
||||
auth_service = AuthService()
|
||||
access_ticket_service = AccessTicketService()
|
||||
|
||||
@ -14,22 +14,22 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from joserfc import jwt
|
||||
from joserfc.jwk import OctKey
|
||||
from joserfc.errors import JoseError, BadSignatureError
|
||||
import base64
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import bcrypt
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import bcrypt
|
||||
from fastapi import HTTPException, status
|
||||
from gns3server.schemas.controller.tokens import TokenData
|
||||
from gns3server.config import Config
|
||||
from joserfc import jwt
|
||||
from joserfc.errors import BadSignatureError, JoseError
|
||||
from joserfc.jwk import OctKey
|
||||
from pydantic import ValidationError
|
||||
|
||||
import logging
|
||||
from gns3server.config import Config
|
||||
from gns3server.schemas.controller.tokens import TokenData
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,19 +15,18 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from uuid import UUID
|
||||
from typing import List, Union
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
import gns3server.db.models as models
|
||||
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
|
||||
|
||||
class ComputesService:
|
||||
|
||||
@ -16,23 +16,22 @@
|
||||
|
||||
import os
|
||||
import uuid
|
||||
import pydantic
|
||||
|
||||
from uuid import UUID
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
import pydantic
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.config import Config
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
|
||||
TEMPLATE_TYPE_TO_SCHEMA: dict[str, type[pydantic.BaseModel]] = {
|
||||
"cloud": schemas.CloudTemplate,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user