diff --git a/exegol-resources b/exegol-resources index a6e78aad..27b2d1a8 160000 --- a/exegol-resources +++ b/exegol-resources @@ -1 +1 @@ -Subproject commit a6e78aade01083c4f50d3d5f0d55b8584d8cd7f0 +Subproject commit 27b2d1a83e30953418497fe889340d7afdab3fb9 diff --git a/exegol/config/ConstantConfig.py b/exegol/config/ConstantConfig.py index b8032413..f6516f56 100644 --- a/exegol/config/ConstantConfig.py +++ b/exegol/config/ConstantConfig.py @@ -5,7 +5,7 @@ class ConstantConfig: """Constant parameters information""" # Exegol Version - version: str = "4.3.8" + version: str = "4.3.9" # Exegol documentation link documentation: str = "https://exegol.rtfd.io/" @@ -22,8 +22,8 @@ class ConstantConfig: # Exegol config directory exegol_config_path: Path = Path().home() / ".exegol" # Docker Desktop for mac config file - docker_desktop_mac_config_path = Path().home() / "Library/Group Containers/group.com.docker/settings.json" - docker_desktop_windows_config_short_path = "AppData/Roaming/Docker/settings.json" + docker_desktop_mac_config_path = Path().home() / "Library/Group Containers/group.com.docker" + docker_desktop_windows_config_short_path = "AppData/Roaming/Docker" docker_desktop_windows_config_path = Path().home() / docker_desktop_windows_config_short_path # Install mode, check if Exegol has been git cloned or installed using pip package git_source_installation: bool = (src_root_path_obj / '.git').is_dir() diff --git a/exegol/config/EnvInfo.py b/exegol/config/EnvInfo.py index 8b9842fb..15a09de4 100644 --- a/exegol/config/EnvInfo.py +++ b/exegol/config/EnvInfo.py @@ -194,30 +194,44 @@ def getDockerDesktopSettings(cls) -> Dict: """Applicable only for docker desktop on macos""" if cls.isDockerDesktop(): if cls.__docker_desktop_resource_config is None: + dir_path = None + file_path = None if cls.is_mac_shell: - path = ConstantConfig.docker_desktop_mac_config_path + # Mac PATH + dir_path = ConstantConfig.docker_desktop_mac_config_path elif cls.is_windows_shell: - path = ConstantConfig.docker_desktop_windows_config_path + # Windows PATH + dir_path = ConstantConfig.docker_desktop_windows_config_path else: + # Windows PATH from WSL shell # Find docker desktop config - config_file = list(Path("/mnt/c/Users").glob(f"*/{ConstantConfig.docker_desktop_windows_config_short_path}")) + config_file = list(Path("/mnt/c/Users").glob(f"*/{ConstantConfig.docker_desktop_windows_config_short_path}/settings-store.json")) if len(config_file) == 0: - return {} - else: - path = config_file[0] - logger.debug(f"Docker desktop config found at {path}") + # Testing with legacy file name + config_file = list(Path("/mnt/c/Users").glob(f"*/{ConstantConfig.docker_desktop_windows_config_short_path}/settings.json")) + if len(config_file) == 0: + logger.warning(f"No docker desktop settings file found.") + return {} + file_path = config_file[0] + if file_path is None: + assert dir_path is not 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"Loading Docker Desktop config from {file_path}") try: - with open(path, 'r') as docker_desktop_config: + with open(file_path, 'r') as docker_desktop_config: cls.__docker_desktop_resource_config = json.load(docker_desktop_config) except FileNotFoundError: - logger.warning(f"Docker Desktop configuration file not found: '{path}'") + logger.warning(f"Docker Desktop configuration file not found: '{file_path}'") return {} return cls.__docker_desktop_resource_config return {} @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: @@ -226,7 +240,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/manager/ExegolManager.py b/exegol/manager/ExegolManager.py index 8c81f700..f609a8e9 100644 --- a/exegol/manager/ExegolManager.py +++ b/exegol/manager/ExegolManager.py @@ -486,7 +486,7 @@ def __prepareContainerConfig(cls): if ParametersManager().envs is not None: for env in ParametersManager().envs: config.addRawEnv(env) - if UserConfig().desktop_default_enable ^ ParametersManager().desktop: + if (UserConfig().desktop_default_enable ^ ParametersManager().desktop) or ParametersManager().desktop_config != "": config.enableDesktop(ParametersManager().desktop_config) if ParametersManager().comment: config.addComment(ParametersManager().comment) diff --git a/exegol/utils/DataFileUtils.py b/exegol/utils/DataFileUtils.py index 7ab6a46a..d6c4ca51 100644 --- a/exegol/utils/DataFileUtils.py +++ b/exegol/utils/DataFileUtils.py @@ -80,6 +80,8 @@ def _create_config_file(self): os.chown(self._file_path, user_uid, user_gid) except PermissionError as e: logger.critical(f"Unable to open the file '{self._file_path}' ({e}). Please fix your file permissions or run exegol with the correct rights.") + except OSError as e: + logger.critical(f"A critical error occurred while interacting with filesystem: [{type(e)}] {e}") def _parse_config(self): data: Dict = {} 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