From ae83c2e3e05387b3b2bfc844de2c696dd17dde5c Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 2 May 2022 09:16:59 -0400 Subject: [PATCH] Island: Relocate aws_service from common to monkey_island --- monkey/common/cmd/aws/aws_cmd_runner.py | 2 +- monkey/monkey_island/cc/resources/remote_run.py | 2 +- .../{common/aws => monkey_island/cc/services}/aws_service.py | 0 monkey/monkey_island/cc/services/initialize.py | 3 +-- monkey/monkey_island/cc/services/reporting/aws_exporter.py | 2 +- monkey/monkey_island/cc/services/reporting/exporter_init.py | 2 +- .../aws => monkey_island/cc/services}/test_aws_service.py | 2 +- 7 files changed, 6 insertions(+), 7 deletions(-) rename monkey/{common/aws => monkey_island/cc/services}/aws_service.py (100%) rename monkey/tests/unit_tests/{common/cloud/aws => monkey_island/cc/services}/test_aws_service.py (95%) diff --git a/monkey/common/cmd/aws/aws_cmd_runner.py b/monkey/common/cmd/aws/aws_cmd_runner.py index 1e00c6b35..bc50c03a8 100644 --- a/monkey/common/cmd/aws/aws_cmd_runner.py +++ b/monkey/common/cmd/aws/aws_cmd_runner.py @@ -1,10 +1,10 @@ import logging import time -from common.aws import aws_service from common.cmd.aws.aws_cmd_result import AwsCmdResult from common.cmd.cmd_runner import CmdRunner from common.cmd.cmd_status import CmdStatus +from monkey_island.cc.services import aws_service logger = logging.getLogger(__name__) diff --git a/monkey/monkey_island/cc/resources/remote_run.py b/monkey/monkey_island/cc/resources/remote_run.py index dd9a4eaf6..f918c9253 100644 --- a/monkey/monkey_island/cc/resources/remote_run.py +++ b/monkey/monkey_island/cc/resources/remote_run.py @@ -4,8 +4,8 @@ import flask_restful from botocore.exceptions import ClientError, NoCredentialsError from flask import jsonify, make_response, request -from common.aws import aws_service from monkey_island.cc.resources.auth.auth import jwt_required +from monkey_island.cc.services import aws_service from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService CLIENT_ERROR_FORMAT = ( diff --git a/monkey/common/aws/aws_service.py b/monkey/monkey_island/cc/services/aws_service.py similarity index 100% rename from monkey/common/aws/aws_service.py rename to monkey/monkey_island/cc/services/aws_service.py diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 06b2473f8..faa3bcef9 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -2,8 +2,7 @@ from pathlib import Path from threading import Thread from common import DIContainer -from common.aws import aws_service -from monkey_island.cc.services import DirectoryFileStorageService, IFileStorageService +from monkey_island.cc.services import DirectoryFileStorageService, IFileStorageService, aws_service from monkey_island.cc.services.post_breach_files import PostBreachFilesService from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService diff --git a/monkey/monkey_island/cc/services/reporting/aws_exporter.py b/monkey/monkey_island/cc/services/reporting/aws_exporter.py index 41d133b19..7811ce60e 100644 --- a/monkey/monkey_island/cc/services/reporting/aws_exporter.py +++ b/monkey/monkey_island/cc/services/reporting/aws_exporter.py @@ -5,8 +5,8 @@ from datetime import datetime import boto3 from botocore.exceptions import UnknownServiceError -from common.aws import aws_service from common.aws.aws_instance import AwsInstance +from monkey_island.cc.services import aws_service from monkey_island.cc.services.reporting.exporter import Exporter __authors__ = ["maor.rayzin", "shay.nehmad"] diff --git a/monkey/monkey_island/cc/services/reporting/exporter_init.py b/monkey/monkey_island/cc/services/reporting/exporter_init.py index 8a84cdadd..bb2d568b9 100644 --- a/monkey/monkey_island/cc/services/reporting/exporter_init.py +++ b/monkey/monkey_island/cc/services/reporting/exporter_init.py @@ -1,6 +1,6 @@ import logging -from common.aws import aws_service +from monkey_island.cc.services import aws_service from monkey_island.cc.services.reporting.aws_exporter import AWSExporter from monkey_island.cc.services.reporting.report_exporter_manager import ReportExporterManager diff --git a/monkey/tests/unit_tests/common/cloud/aws/test_aws_service.py b/monkey/tests/unit_tests/monkey_island/cc/services/test_aws_service.py similarity index 95% rename from monkey/tests/unit_tests/common/cloud/aws/test_aws_service.py rename to monkey/tests/unit_tests/monkey_island/cc/services/test_aws_service.py index f66646b34..0d8a71f36 100644 --- a/monkey/tests/unit_tests/common/cloud/aws/test_aws_service.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/test_aws_service.py @@ -1,7 +1,7 @@ import json from unittest import TestCase -from common.aws.aws_service import filter_instance_data_from_aws_response +from monkey_island.cc.services.aws_service import filter_instance_data_from_aws_response class TestAwsService(TestCase):