From 523ade89aac5cfdb9b725a5ee51ee18b1177f987 Mon Sep 17 00:00:00 2001 From: jdorsch Date: Thu, 29 Feb 2024 12:46:30 +0100 Subject: [PATCH] fixed bad parsing in F7T_FILESYSTEMS --- src/status/status.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/status/status.py b/src/status/status.py index d5464fd7..778a97a9 100644 --- a/src/status/status.py +++ b/src/status/status.py @@ -19,12 +19,20 @@ from jaeger_client import Config import opentracing +app = Flask(__name__) +logger = setup_logging(logging, 'status') AUTH_HEADER_NAME = os.environ.get("F7T_AUTH_HEADER_NAME","Authorization") SYSTEMS_PUBLIC = os.environ.get("F7T_SYSTEMS_PUBLIC").strip('\'"').split(";") -FILESYSTEMS = ast.literal_eval(os.environ.get("F7T_FILESYSTEMS", {})) +try: + FILESYSTEMS = ast.literal_eval(os.environ.get("F7T_FILESYSTEMS", {}).strip('\'"')) +except Exception as e: + app.logger.error(e) + app.logger.error("Error parsing F7T_FILESYSTEMS env var. Filesystems information will not be available") + app.logger.error(f"Current value: F7T_FILESYSTEMS={os.environ.get('F7T_FILESYSTEMS')}") + FILESYSTEMS = {} SERVICES = os.environ.get("F7T_STATUS_SERVICES").strip('\'"').split(";") # ; separated service names SYSTEMS = os.environ.get("F7T_STATUS_SYSTEMS").strip('\'"').split(";") # ; separated systems names @@ -53,9 +61,7 @@ # debug on console DEBUG_MODE = get_boolean_var(os.environ.get("F7T_DEBUG_MODE", False)) -app = Flask(__name__) -logger = setup_logging(logging, 'status') JAEGER_AGENT = os.environ.get("F7T_JAEGER_AGENT", "").strip('\'"') if JAEGER_AGENT != "":