Updated exporter initialization

Exporter now detects if the server is running on AWS automatically.
This commit is contained in:
Shay Nehmad 2019-04-23 13:24:06 +03:00
parent 63c00d656f
commit 7f0418f91b
1 changed files with 8 additions and 9 deletions

View File

@ -1,19 +1,18 @@
from monkey_island.cc.environment.environment import load_env_from_file, AWS
import logging
from monkey_island.cc.report_exporter_manager import ReportExporterManager
from monkey_island.cc.resources.aws_exporter import AWSExporter
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
__author__ = 'maor.rayzin'
logger = logging.getLogger(__name__)
def populate_exporter_list():
manager = ReportExporterManager()
if is_aws_exporter_required():
if RemoteRunAwsService.is_running_on_aws():
manager.add_exporter_to_list(AWSExporter)
if len(manager.get_exporters_list()) != 0:
logger.debug(
"Populated exporters list with the following exporters: {0}".format(str(manager.get_exporters_list())))
def is_aws_exporter_required():
if str(load_env_from_file()) == AWS:
return True
else:
return False