Skip to content

Commit

Permalink
Update docker desktop new settings keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramelac committed Dec 17, 2024
1 parent 2b9579a commit f687897
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions exegol/config/EnvInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion exegol/utils/GuiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f687897

Please sign in to comment.