From cae1f988662dd15215ba6d514722e812beb05e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 13 Jun 2024 12:44:12 +0200 Subject: [PATCH] fix: Avoid webinterface to crash if the monitoring in unavailable --- lookyloo/lookyloo.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index ea961cf..b2d1b0c 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -165,10 +165,13 @@ class Lookyloo(): if monitoring_config['enable']: self.monitoring = PyLookylooMonitoring(monitoring_config['url'], get_useragent_for_requests()) if self.monitoring.is_up: - self.monitoring_enabled = True - # NOTE: maybe move that somewhere else: we'll need to restart the webserver - # if we change the settings in the monitoring instance - self.monitoring_settings = self.monitoring.instance_settings() + try: + # NOTE: maybe move that somewhere else: we'll need to restart the webserver + # if we change the settings in the monitoring instance + self.monitoring_settings = self.monitoring.instance_settings() + self.monitoring_enabled = True + except Exception as e: + self.logger.critical(f'Unable to initialize the monitoring instance: {e}') self.logger.info('Initializing context...') self.context = Context()