Island: Remove report exporter manager

We only have AWS report exporter, no point to keep this infrastructure
This commit is contained in:
vakarisz 2022-05-11 17:08:13 +03:00
parent 7ed7164a03
commit 70ae745a52
3 changed files with 1 additions and 53 deletions

View File

@ -1,28 +0,0 @@
import logging
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
logger = logging.getLogger(__name__)
def populate_exporter_list():
manager = ReportExporterManager()
# try_add_aws_exporter_to_manager(manager)
if len(manager.get_exporters_list()) != 0:
logger.debug(
"Populated exporters list with the following exporters: {0}".format(
str(manager.get_exporters_list())
)
)
def try_add_aws_exporter_to_manager(manager):
# noinspection PyBroadException
try:
if aws_service.is_on_aws():
manager.add_exporter_to_list(AWSExporter)
except Exception:
logger.error("Failed adding aws exporter to manager. Exception info:", exc_info=True)

View File

@ -497,7 +497,7 @@ class ReportService:
"meta_info": {"latest_monkey_modifytime": monkey_latest_modify_time},
}
save_report(report)
aws_exporter.handle_report(report, ReportService._aws_service.island_aws_instance())
aws_exporter.handle_report(report, ReportService._aws_service.island_aws_instance)
return report
@staticmethod

View File

@ -1,24 +0,0 @@
import logging
from common.utils.code_utils import Singleton
logger = logging.getLogger(__name__)
class ReportExporterManager(object, metaclass=Singleton):
def __init__(self):
self._exporters_set = set()
def get_exporters_list(self):
return self._exporters_set
def add_exporter_to_list(self, exporter):
self._exporters_set.add(exporter)
def export(self, report):
for exporter in self._exporters_set:
logger.debug("Trying to export using " + repr(exporter))
try:
exporter().handle_report(report)
except Exception as e:
logger.exception("Failed to export report, error: " + e)