]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager/server.py: check the parent dir of each config file
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 30 Jun 2025 19:05:26 +0000 (21:05 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 4 Jul 2025 17:12:45 +0000 (19:12 +0200)
Compare the locations of multiple configuration files and issue a warning

python/knot_resolver/manager/server.py

index 53fe3ac5754478e76e918f6fca465e6c52bfd320..8096f03cc6db82e913453abd5edf9679a0173e0c 100644 (file)
@@ -568,6 +568,15 @@ async def start_server(config: List[str]) -> int:  # noqa: PLR0915
 
         config_data: Dict[str, Any] = {}
         for file in config_absolute:
+            # warning about the different parent directories of each config file
+            # compared to the first one which is used as the prefix path
+            if config_absolute[0].parent != file.parent:
+                logger.warning(
+                    f"The configuration file '{file}' has a parent directory that is different"
+                    f" from '{config_absolute[0]}', which is used as the prefix for relative paths."
+                    "This can cause issues with files that are configured with relative paths."
+                )
+
             # Preprocess config - load from file or in general take it to the last step before validation.
             config_raw = await _load_raw_config(file)