From e5eeab662e927b41448cdf13ac842cbe9799ce72 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 20 Jun 2023 21:26:21 +0930 Subject: [PATCH] Check if server config file is readable --- gns3server/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gns3server/config.py b/gns3server/config.py index b01e076d..a01b5491 100644 --- a/gns3server/config.py +++ b/gns3server/config.py @@ -49,6 +49,8 @@ class Config: self._profile = profile if files and len(files): + if not os.access(files[0], os.R_OK) or not os.path.isfile(files[0]): + raise SystemExit(f"Unable to read configuration file: {files[0]}") directory_name = os.path.dirname(files[0]) if not directory_name or directory_name == "": files[0] = os.path.dirname(os.path.abspath(files[0])) + os.path.sep + files[0]