Contain exception if exporter init fails on the island

This commit is contained in:
Shay Nehmad 2019-10-13 10:48:23 +03:00
parent b6b58b3c50
commit 53361e3812
1 changed files with 10 additions and 3 deletions

View File

@ -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)