From f6878973d9de6a49839fd162381744277664b090 Mon Sep 17 00:00:00 2001 From: Dramelac Date: Tue, 17 Dec 2024 19:01:22 +0100 Subject: [PATCH] Update docker desktop new settings keys --- exegol/config/EnvInfo.py | 10 +++++++--- exegol/utils/GuiUtils.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/exegol/config/EnvInfo.py b/exegol/config/EnvInfo.py index 0a46f899..a8a2fb88 100644 --- a/exegol/config/EnvInfo.py +++ b/exegol/config/EnvInfo.py @@ -216,7 +216,7 @@ def getDockerDesktopSettings(cls) -> Dict: if file_path is None: # Try to find settings file with new filename or fallback to legacy filename for Docker Desktop older than 4.34 file_path = (dir_path / "settings-store.json") if (dir_path / "settings-store.json").is_file() else (dir_path / "settings.json") - logger.debug(f"Docker desktop config found at {file_path}") + logger.debug(f"Loading Docker Desktop config from {file_path}") try: with open(file_path, 'r') as docker_desktop_config: cls.__docker_desktop_resource_config = json.load(docker_desktop_config) @@ -228,7 +228,9 @@ def getDockerDesktopSettings(cls) -> Dict: @classmethod def getDockerDesktopResources(cls) -> List[str]: - return cls.getDockerDesktopSettings().get('filesharingDirectories', []) + settings = cls.getDockerDesktopSettings() + # Handle legacy settings key + return settings.get('FilesharingDirectories', settings.get('filesharingDirectories', [])) @classmethod def isHostNetworkAvailable(cls) -> bool: @@ -237,7 +239,9 @@ def isHostNetworkAvailable(cls) -> bool: elif cls.isOrbstack(): return True elif cls.isDockerDesktop(): - res = cls.getDockerDesktopSettings().get('hostNetworkingEnabled', False) + settings = cls.getDockerDesktopSettings() + # Handle legacy settings key + res = settings.get('HostNetworkingEnabled', settings.get('hostNetworkingEnabled', False)) return res if res is not None else False logger.warning("Unknown or not supported environment for host network mode.") return False diff --git a/exegol/utils/GuiUtils.py b/exegol/utils/GuiUtils.py index 47ccc741..61d11056 100644 --- a/exegol/utils/GuiUtils.py +++ b/exegol/utils/GuiUtils.py @@ -418,7 +418,7 @@ def __create_default_wsl(cls) -> bool: pass # Check if docker have default docker integration docker_settings = EnvInfo.getDockerDesktopSettings() - if docker_settings is not None and docker_settings.get("enableIntegrationWithDefaultWslDistro", False): + if docker_settings is not None and docker_settings.get("EnableIntegrationWithDefaultWslDistro", docker_settings.get("enableIntegrationWithDefaultWslDistro", False)): logger.verbose("Set WSL Ubuntu as default to automatically enable docker integration") logger.debug("Running: C:\\Windows\\system32\\wsl.exe -s Ubuntu") # Set new WSL distribution as default to start it and enable docker integration