From 53361e3812dca73dc39c16710f9949d9965c96a8 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 13 Oct 2019 10:48:23 +0300 Subject: [PATCH] Contain exception if exporter init fails on the island --- .../cc/services/reporting/exporter_init.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/services/reporting/exporter_init.py b/monkey/monkey_island/cc/services/reporting/exporter_init.py index bd4e82f3e..de478bfe7 100644 --- a/monkey/monkey_island/cc/services/reporting/exporter_init.py +++ b/monkey/monkey_island/cc/services/reporting/exporter_init.py @@ -9,11 +9,18 @@ logger = logging.getLogger(__name__) def populate_exporter_list(): manager = ReportExporterManager() - RemoteRunAwsService.init() - if RemoteRunAwsService.is_running_on_aws() and ('aws' == env.get_deployment()): - manager.add_exporter_to_list(AWSExporter) + 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: + RemoteRunAwsService.init() + if RemoteRunAwsService.is_running_on_aws() and ('aws' == env.get_deployment()): + manager.add_exporter_to_list(AWSExporter) + except Exception as err: + logger.error("Failed adding aws exporter to manager.", exc_info=True)