From 3a94be87665a7f4ee8f767de9b12e0bf5a5a6db6 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 22 Aug 2022 11:19:15 -0400 Subject: [PATCH] Common: Move base_models.py to common --- monkey/common/__init__.py | 1 + monkey/{monkey_island/cc/models => common}/base_models.py | 0 monkey/monkey_island/cc/models/agent.py | 3 ++- monkey/monkey_island/cc/models/machine.py | 2 +- monkey/monkey_island/cc/models/node.py | 3 ++- 5 files changed, 6 insertions(+), 3 deletions(-) rename monkey/{monkey_island/cc/models => common}/base_models.py (100%) diff --git a/monkey/common/__init__.py b/monkey/common/__init__.py index af48cd045..5dee4b146 100644 --- a/monkey/common/__init__.py +++ b/monkey/common/__init__.py @@ -4,3 +4,4 @@ Used for a common things between agent and island from .di_container import DIContainer, UnresolvableDependencyError from .operating_system import OperatingSystem from . import types +from . import base_models diff --git a/monkey/monkey_island/cc/models/base_models.py b/monkey/common/base_models.py similarity index 100% rename from monkey/monkey_island/cc/models/base_models.py rename to monkey/common/base_models.py diff --git a/monkey/monkey_island/cc/models/agent.py b/monkey/monkey_island/cc/models/agent.py index 73ff8d693..b3e79c4e2 100644 --- a/monkey/monkey_island/cc/models/agent.py +++ b/monkey/monkey_island/cc/models/agent.py @@ -4,8 +4,9 @@ from uuid import UUID from pydantic import Field +from common.base_models import MutableBaseModel + from . import MachineID -from .base_models import MutableBaseModel class Agent(MutableBaseModel): diff --git a/monkey/monkey_island/cc/models/machine.py b/monkey/monkey_island/cc/models/machine.py index 8e2c0d122..1ead17cc6 100644 --- a/monkey/monkey_island/cc/models/machine.py +++ b/monkey/monkey_island/cc/models/machine.py @@ -4,9 +4,9 @@ from typing import Optional, Sequence from pydantic import Field, PositiveInt, validator from common import OperatingSystem +from common.base_models import MutableBaseModel from common.types import HardwareID -from .base_models import MutableBaseModel from .transforms import make_immutable_sequence MachineID = PositiveInt diff --git a/monkey/monkey_island/cc/models/node.py b/monkey/monkey_island/cc/models/node.py index 6fa307734..136633aa6 100644 --- a/monkey/monkey_island/cc/models/node.py +++ b/monkey/monkey_island/cc/models/node.py @@ -2,8 +2,9 @@ from typing import Sequence, Tuple from pydantic import Field, validator +from common.base_models import MutableBaseModel + from . import CommunicationType, MachineID -from .base_models import MutableBaseModel from .transforms import make_immutable_nested_sequence ConnectionsSequence = Sequence[Tuple[MachineID, Sequence[CommunicationType]]]