Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.3.0 #195

Merged
merged 115 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
89bef9b
Add entrypoint v2
Dramelac Jul 13, 2023
343e4b1
Wrapper can now show container startup status update
Dramelac Jul 22, 2023
3349046
Add dev comments
Dramelac Jul 23, 2023
d32e30d
Add tips for startup skip
Dramelac Jul 23, 2023
83e5ec2
Add random password generation
Dramelac Jul 25, 2023
8ac1472
Handling temporary container with entrypoint v2
Dramelac Jul 31, 2023
73df067
Update entrypoint v2 parameters
Dramelac Aug 3, 2023
395a08b
Reorganize ContainerConfig with sections
Dramelac Aug 4, 2023
c479182
Add Exegol Desktop feature
Dramelac Aug 6, 2023
b1b91b1
Update desktop script + add nvnc redirect
Dramelac Aug 8, 2023
e5626e6
Fix password update
Dramelac Aug 8, 2023
98b5c88
Fix utf-8 encoding
Dramelac Aug 8, 2023
09f00ee
Fix password update + update start desktop
Dramelac Aug 8, 2023
6ad691e
Exegol update change branch with -v only
Dramelac Aug 9, 2023
fbbede9
Refacto ImageSync + add start.sh
Dramelac Aug 9, 2023
2e33ef9
start.sh v2 with shell logging support
Dramelac Aug 9, 2023
894c6cc
Patch default shell with entrypointv2
Dramelac Aug 9, 2023
b4c3da1
Improve start.sh shell logging
Dramelac Aug 10, 2023
3ba77fe
Update stop timeout
Dramelac Aug 10, 2023
d19688d
Bump next test version
Dramelac Aug 10, 2023
e61dc1a
Merge branch 'webui' into dev
Dramelac Aug 10, 2023
4380b43
Upgrade beta version for desktop & entrypoint version
Dramelac Aug 10, 2023
cb2f743
Changing error messages for unsupported features
ShutdownRepo Aug 10, 2023
afab6b7
Use IP config instead of localhost dns name
Dramelac Aug 10, 2023
2696e8a
Replacing GUI texts with X11
ShutdownRepo Aug 10, 2023
943e748
Internal service must be exposed to 0.0.0.0 wth port forwarding
Dramelac Aug 10, 2023
aebe31e
Adding FIXME in desktop exposition
ShutdownRepo Aug 10, 2023
fbd9d6e
Fix warning message
Dramelac Aug 22, 2023
fb1a0eb
Add start.sh update procedure
Dramelac Aug 24, 2023
2165efb
Change chmod
Dramelac Aug 24, 2023
53ad6ae
Fix ConstantConfig import path
Dramelac Aug 24, 2023
51ee2a0
Add mypy source test
Dramelac Aug 24, 2023
1b21bc7
Disable start volume + support beta start versioning
Dramelac Aug 25, 2023
e15c4c8
Rename start.sh to spawn.sh + warning for mac /opt path
Dramelac Aug 28, 2023
e699157
Adding ro|rw to start help dialog + debug info tables
ShutdownRepo Aug 28, 2023
e131eac
Fix enum print value
Dramelac Aug 29, 2023
d303809
Fix error handling
Dramelac Aug 29, 2023
3af518c
adding logs for datacache update
ShutdownRepo Aug 30, 2023
48080ad
better looks for container and image logs
ShutdownRepo Aug 30, 2023
09b79f9
changing downloads badge
ShutdownRepo Aug 31, 2023
016b56b
better logs for image builds
ShutdownRepo Sep 2, 2023
068b3e1
adding note on workflows pr trigger paths-ignore filter
ShutdownRepo Sep 2, 2023
35bc0d7
Update README.md
ShutdownRepo Sep 7, 2023
fe8df5a
catching exception and returning port -1 when cannot bind
ShutdownRepo Sep 27, 2023
3b9df15
fixing port definition logic
ShutdownRepo Sep 27, 2023
20df3f6
fixing automatic port definition statement structure
ShutdownRepo Sep 27, 2023
44090f3
Simplify port finder logic
Dramelac Sep 28, 2023
c72e683
Add a check on create mode if the network is available
Dramelac Sep 28, 2023
c9866c2
Use with format for socket
Dramelac Sep 28, 2023
9b697f1
Merge pull request #184 from ThePorgs/fix/missing_iface
Dramelac Sep 28, 2023
89d6268
better test command
ShutdownRepo Sep 30, 2023
42308d6
removing special chars from random root password
ShutdownRepo Oct 5, 2023
5d901d6
Merge pull request #187 from ThePorgs/fix/desktop/password_bad_chars
ShutdownRepo Oct 5, 2023
1885fb2
opt restriction for Orbstack only
Dramelac Oct 11, 2023
289d753
Update exegol env name
Dramelac Oct 11, 2023
f80e7e2
Supply exegol container name when hostname is overridden
Dramelac Oct 12, 2023
a4c07b2
Using eth0 interface for desktop service when using bridge
Dramelac Oct 14, 2023
b525d69
Using hostname of the container instead
Dramelac Oct 14, 2023
7c6286d
Update hostname management and extra_hosts
Dramelac Oct 14, 2023
22afbdc
Add exegol name env to the config enum
Dramelac Oct 14, 2023
ae67627
Add exegol randomize service port flag
Dramelac Oct 14, 2023
068ea05
adding estimated remote image size on disk
ShutdownRepo Oct 17, 2023
09ce9e8
adding estimated remote image size on disk when pulling an image
ShutdownRepo Oct 17, 2023
3d937d0
changing bug request title prefix
ShutdownRepo Oct 19, 2023
97967b0
Fix git update return code
Dramelac Oct 21, 2023
35fe27e
Disable VncAuth method
Dramelac Oct 21, 2023
cebc5f2
Add username env config
Dramelac Oct 21, 2023
969aad1
Fix mypy web response
Dramelac Oct 21, 2023
7427383
Fix mypy web response
Dramelac Oct 21, 2023
a0d5059
Merge remote-tracking branch 'origin/dev' into estimated_remote_size
Dramelac Oct 21, 2023
ee6a85f
replacing logger.raw with logger.info for image download intro
ShutdownRepo Oct 21, 2023
3ff0d65
removing unused logging import
ShutdownRepo Oct 21, 2023
f53ff45
removing duplicate getSize function
ShutdownRepo Oct 21, 2023
6001890
Update comments
Dramelac Oct 22, 2023
944e5ec
Merge pull request #189 from ThePorgs/estimated_remote_size
Dramelac Oct 22, 2023
26836aa
initiating custom dockerfiles path for local build
ShutdownRepo Oct 24, 2023
6dd76be
Update build profile completer + security checks
Dramelac Oct 24, 2023
72266bc
Fix last update time format
Dramelac Oct 24, 2023
9a54364
Fix exegol-resources submodules for pip env
Dramelac Oct 24, 2023
efe122a
Fix entrypoint script for pip install
Dramelac Oct 24, 2023
9fccae9
Merge pull request #190 from ThePorgs/custom_build_path
Dramelac Oct 24, 2023
2006581
Add comment for alpha & beta re-upload
Dramelac Oct 28, 2023
ab11cf5
Disable startup sequence for legacy container
Dramelac Oct 28, 2023
2a8c05c
Mute warning when nothing to change
Dramelac Oct 28, 2023
366afa7
Fix rollback of non-empty workspace
Dramelac Oct 29, 2023
de9e7e1
Fix Path parsing on Windows
Dramelac Oct 29, 2023
cef1345
Fix WSLg path test
Dramelac Oct 29, 2023
c612d78
Add support for WSLg on Win10
Dramelac Oct 29, 2023
7488724
Add todo for windows cross env support
Dramelac Oct 29, 2023
7e6cd0c
Update windows path
Dramelac Oct 29, 2023
0e67813
Suppress external lib from traceback
Dramelac Nov 14, 2023
f253741
Fix root bypass permission error
Dramelac Nov 15, 2023
ad6f262
Add static ip to handle GUI with VPN new default route
Dramelac Nov 26, 2023
1472d35
Fix symlink mismatch from host
Dramelac Nov 27, 2023
84b05a8
adding beta mention for the desktop
ShutdownRepo Dec 11, 2023
aaf8057
Detect using docker desktop on linux
Dramelac Dec 13, 2023
b0de254
Fix mac OS detection
Dramelac Dec 14, 2023
7ba69a1
changing image install message
ShutdownRepo Dec 16, 2023
9da26fd
Fix install message
Dramelac Dec 18, 2023
9ecb273
Handle docker timeout errors
Dramelac Dec 19, 2023
02bca4a
Update bash scripts
Dramelac Dec 19, 2023
6a0d2e6
Update pypi publish method
Dramelac Dec 19, 2023
8dc8716
Remove rich bracket escape
Dramelac Dec 19, 2023
60e1cd6
New beta version
Dramelac Dec 19, 2023
894cab2
Fix pre-release pipeline
Dramelac Dec 20, 2023
37e5a32
Improve pre-release checks
Dramelac Dec 20, 2023
900ff12
Change pre-release checks order
Dramelac Dec 20, 2023
3ab4065
Fix timeout error
Dramelac Dec 21, 2023
0e51d85
TODO & config update
Dramelac Dec 21, 2023
0a3ef75
Ready for new release
Dramelac Dec 21, 2023
1fa1f2a
Fix empty string on build date
Dramelac Dec 21, 2023
e94d4f3
Update submodule ref
Dramelac Dec 22, 2023
e330e66
Align test release version
Dramelac Dec 22, 2023
f701cad
Upgrade dependencies versions
Dramelac Dec 22, 2023
d82056e
Add py3.12 tests
Dramelac Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🐞 Bug report [WRAPPER]
description: Report a bug in Exegol WRAPPER to help us improve it
title: "[BUG] <title>"
title: "<title>"
labels:
- bug
body:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/entrypoint_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions to TestPyPI 📦
runs-on: ubuntu-latest
environment: nightly
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
needs: test
steps:
- uses: actions/checkout@master
Expand All @@ -33,6 +37,5 @@ jobs:
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
25 changes: 22 additions & 3 deletions .github/workflows/entrypoint_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,38 @@ on:
pull_request:
branches:
- "master"
paths-ignore:
paths-ignore: # not always respected. See https://github.com/actions/runner/issues/2324#issuecomment-1703345084
- ".github/**"
- "**.md"

jobs:
test:
preprod_test:
name: Pre-prod code testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
submodules: false
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Find spawn.sh script version
run: egrep '^# Spawn Version:[0-9ab]+$' ./exegol/utils/imgsync/spawn.sh | cut -d ':' -f2
- name: Check for prod readiness of spawn.sh script version
run: egrep '^# Spawn Version:[0-9]+$' ./exegol/utils/imgsync/spawn.sh
- name: Check package version (alpha and beta version cannot be released)
run: python3 -c 'from exegol.config.ConstantConfig import ConstantConfig; print(ConstantConfig.version); exit(any(c in ConstantConfig.version for c in ["a", "b"]))'

code_test:
name: Python tests and checks
needs: preprod_test
uses: ./.github/workflows/sub_testing.yml

build:
name: Build Python 🐍 distributions
runs-on: ubuntu-latest
needs: test
needs: code_test
steps:
- uses: actions/checkout@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/entrypoint_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
branches-ignore:
- "master"
paths-ignore:
paths-ignore: # not always respected. See https://github.com/actions/runner/issues/2324#issuecomment-1703345084
- ".github/**"
- "**.md"
push:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/entrypoint_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions to PyPI 📦
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
needs: test
steps:
- uses: actions/checkout@master
Expand All @@ -31,10 +35,7 @@ jobs:
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI (prod)
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
12 changes: 8 additions & 4 deletions .github/workflows/sub_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
- name: Install requirements
run: python -m pip install --user mypy types-requests types-PyYAML
- name: Run code analysis
- name: Run code analysis (package)
run: mypy ./exegol/ --ignore-missing-imports --check-untyped-defs --pretty # TODO add --disallow-untyped-defs
- name: Run code analysis (source)
run: mypy ./exegol.py --ignore-missing-imports --check-untyped-defs --pretty # TODO add --disallow-untyped-defs
- name: Find spawn.sh script version
run: egrep '^# Spawn Version:[0-9ab]+$' ./exegol/utils/imgsync/spawn.sh | cut -d ':' -f2

compatibility:
name: Compatibility checks
Expand All @@ -27,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [win32, linux, darwin]
steps:
- uses: actions/checkout@master
Expand All @@ -36,7 +40,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
- name: Install requirements
run: python -m pip install --user mypy types-requests types-PyYAML
- name: Check python compatibility for ${{ matrix.os }}/${{ matrix.version }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<br><br>
<a target="_blank" rel="noopener noreferrer" href="https://pypi.org/project/Exegol" title=""><img src="https://img.shields.io/pypi/v/Exegol?color=informational" alt="pip package version"></a>
<img alt="Python3.7" src="https://img.shields.io/badge/Python-3.7+-informational">
<a target="_blank" rel="noopener noreferrer" href="https://pepy.tech/project/exegol" title=""><img src="https://static.pepy.tech/personalized-badge/exegol?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads" alt="pip stats"></a>
<img alt="latest commit on master" src="https://img.shields.io/docker/pulls/nwodtuhs/exegol.svg?label=downloads">
<br><br>
<img alt="latest commit on master" src="https://img.shields.io/github/last-commit/ThePorgs/Exegol/master?label=latest%20release">
<img alt="latest commit on dev" src="https://img.shields.io/github/last-commit/ThePorgs/Exegol/dev?label=latest%20dev">
Expand Down Expand Up @@ -37,7 +37,7 @@

# Getting started

You can refer to the [Exegol documentations](https://exegol.readthedocs.io/en/latest/getting-started/install.html).
You can refer to the [Exegol documentation](https://exegol.readthedocs.io/en/latest/getting-started/install.html).

> Full documentation homepage: https://exegol.rtfd.io/.

Expand Down
2 changes: 1 addition & 1 deletion exegol-docker-build
2 changes: 1 addition & 1 deletion exegol-resources
Submodule exegol-resources updated 415 files
26 changes: 16 additions & 10 deletions exegol/config/ConstantConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class ConstantConfig:
"""Constant parameters information"""
# Exegol Version
version: str = "4.2.5"
version: str = "4.3.0"

# Exegol documentation link
documentation: str = "https://exegol.rtfd.io/"
Expand All @@ -15,6 +15,10 @@ class ConstantConfig:
# Path of the Dockerfile
build_context_path_obj: Path
build_context_path: str
# Path of the entrypoint.sh
entrypoint_context_path_obj: Path
# Path of the spawn.sh
spawn_context_path_obj: Path
# Exegol config directory
exegol_config_path: Path = Path().home() / ".exegol"
# Docker Desktop for mac config file
Expand All @@ -33,13 +37,12 @@ class ConstantConfig:
EXEGOL_RESOURCES_REPO: str = "https://github.com/ThePorgs/Exegol-resources.git"

@classmethod
def findBuildContextPath(cls) -> Path:
"""Find the right path to the build context from Exegol docker images.
def findResourceContextPath(cls, resource_folder: str, source_path: str) -> Path:
"""Find the right path to the resources context from Exegol package.
Support source clone installation and pip package (venv / user / global context)"""
dockerbuild_folder_name = "exegol-docker-build"
local_src = cls.src_root_path_obj / dockerbuild_folder_name
if local_src.is_dir():
# If exegol is clone from github, build context is accessible from root src
local_src = cls.src_root_path_obj / source_path
if local_src.is_dir() or local_src.is_file():
# If exegol is clone from GitHub, build context is accessible from root src
return local_src
else:
# If install from pip
Expand All @@ -51,13 +54,16 @@ def findBuildContextPath(cls) -> Path:
possible_locations.append(Path(loc).parent.parent.parent)
# Find a good match
for test in possible_locations:
context_path = test / dockerbuild_folder_name
context_path = test / resource_folder
if context_path.is_dir():
return context_path
# Detect a venv context
return Path(site.PREFIXES[0]) / dockerbuild_folder_name
return Path(site.PREFIXES[0]) / resource_folder


# Dynamically built attribute must be set after class initialization
ConstantConfig.build_context_path_obj = ConstantConfig.findBuildContextPath()
ConstantConfig.build_context_path_obj = ConstantConfig.findResourceContextPath("exegol-docker-build", "exegol-docker-build")
ConstantConfig.build_context_path = str(ConstantConfig.build_context_path_obj)

ConstantConfig.entrypoint_context_path_obj = ConstantConfig.findResourceContextPath("exegol-imgsync", "exegol/utils/imgsync/entrypoint.sh")
ConstantConfig.spawn_context_path_obj = ConstantConfig.findResourceContextPath("exegol-imgsync", "exegol/utils/imgsync/spawn.sh")
17 changes: 16 additions & 1 deletion exegol/config/DataCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ def get_images_data(self) -> ImagesCacheModel:

def update_image_cache(self, images: List):
"""Refresh image cache data"""
cache_images = [ImageCacheModel(img.getName(), img.getLatestVersion(), img.getLatestRemoteId(), "local" if img.isLocal() else "remote") for img in images]
logger.debug("Updating image cache data")
cache_images = []
for img in images:
name = img.getName()
version = img.getLatestVersion()
remoteid = img.getLatestRemoteId()
type = "local" if img.isLocal() else "remote"
logger.debug(f"└── {name} (version: {version})\t→ ({type}) {remoteid}")
cache_images.append(
ImageCacheModel(
name,
version,
remoteid,
type
)
)
self.__cache_data.images = ImagesCacheModel(cache_images)
self.save_updates()
30 changes: 7 additions & 23 deletions exegol/config/EnvInfo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import json
import platform
import re
import shutil
import subprocess
from enum import Enum
from typing import Optional, Any, List

Expand All @@ -24,7 +21,7 @@ class DockerEngine(Enum):
"""Dictionary class for static Docker engine name"""
WLS2 = "WSL2"
HYPERV = "Hyper-V"
MAC = "Docker desktop"
DOCKER_DESKTOP = "Docker desktop"
ORBSTACK = "Orbstack"
LINUX = "Kernel"

Expand Down Expand Up @@ -88,8 +85,8 @@ def initData(cls, docker_info):
cls.__docker_host_os = cls.HostOs.WINDOWS
elif cls.__is_docker_desktop:
# If docker desktop is detected but not a Windows engine/kernel, it's (probably) a mac
cls.__docker_engine = cls.DockerEngine.MAC
cls.__docker_host_os = cls.HostOs.MAC
cls.__docker_engine = cls.DockerEngine.DOCKER_DESKTOP
cls.__docker_host_os = cls.HostOs.MAC if cls.is_mac_shell else cls.HostOs.LINUX
elif is_orbstack:
# Orbstack is only available on Mac
cls.__docker_engine = cls.DockerEngine.ORBSTACK
Expand All @@ -99,6 +96,9 @@ def initData(cls, docker_info):
cls.__docker_engine = cls.DockerEngine.LINUX
cls.__docker_host_os = cls.HostOs.LINUX

if cls.__docker_engine == cls.DockerEngine.DOCKER_DESKTOP and cls.__docker_host_os == cls.HostOs.LINUX:
logger.warning(f"Using Docker Desktop on Linux is not officially supported !")

@classmethod
def getHostOs(cls) -> HostOs:
"""Return Host OS
Expand All @@ -114,24 +114,8 @@ def getWindowsRelease(cls) -> str:
if cls.is_windows_shell:
# From a Windows shell, python supply an approximate (close enough) version of windows
cls.__windows_release = platform.win32_ver()[1]
elif cls.current_platform == "WSL":
# From a WSL shell, we must create a process to retrieve the host's version
# Find version using MS-DOS command 'ver'
if not shutil.which("cmd.exe"):
logger.critical("cmd.exe is not accessible from your WSL environment!")
proc = subprocess.Popen(["cmd.exe", "/c", "ver"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
proc.wait()
assert proc.stdout is not None
# Try to match Windows version
matches = re.search(r"version (\d+\.\d+\.\d+)(\.\d*)?", proc.stdout.read().decode('utf-8'))
if matches:
# Select match 1 and apply to the attribute
cls.__windows_release = matches.group(1)
else:
# If there is any match, fallback to empty
cls.__windows_release = ""
else:
cls.__windows_release = ""
cls.__windows_release = "Unknown"
return cls.__windows_release

@classmethod
Expand Down
27 changes: 26 additions & 1 deletion exegol/config/UserConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class UserConfig(DataFileUtils, metaclass=MetaSingleton):
# Static choices
start_shell_options = {'zsh', 'bash', 'tmux'}
shell_logging_method_options = {'script', 'asciinema'}
desktop_available_proto = {'http', 'vnc'}

def __init__(self):
# Defaults User config
Expand All @@ -25,11 +26,15 @@ def __init__(self):
self.default_start_shell: str = "zsh"
self.shell_logging_method: str = "asciinema"
self.shell_logging_compress: bool = True
self.desktop_default_enable: bool = False
self.desktop_default_localhost: bool = True
self.desktop_default_proto: str = "http"

super().__init__("config.yml", "yml")

def _build_file_content(self):
config = f"""# Exegol configuration
# Full documentation: https://exegol.readthedocs.io/en/latest/exegol-wrapper/advanced-uses.html#id1

# Volume path can be changed at any time but existing containers will not be affected by the update
volumes:
Expand Down Expand Up @@ -63,11 +68,22 @@ def _build_file_content(self):

# Enable automatic compression of log files (with gzip)
enable_log_compression: {self.shell_logging_compress}

# Configure your Exegol Desktop
desktop:
# Enables or not the desktop mode by default
# If this attribute is set to True, then using the CLI --desktop option will be inverted and will DISABLE the feature
enabled_by_default: {self.desktop_default_enable}

# Default desktop protocol,can be "http", or "vnc" (additional protocols to come in the future, check online documentation for updates).
default_protocol: {self.desktop_default_proto}

# Desktop service is exposed on localhost by default. If set to true, services will be exposed on localhost (127.0.0.1) otherwise it will be exposed on 0.0.0.0. This setting can be overwritten with --desktop-config
localhost_by_default: {self.desktop_default_localhost}

"""
# TODO handle default image selection
# TODO handle default start container
# TODO add custom build profiles path
return config

@staticmethod
Expand Down Expand Up @@ -105,6 +121,12 @@ def _process_data(self):
self.shell_logging_method = self._load_config_str(shell_logging_data, 'logging_method', self.shell_logging_method, choices=self.shell_logging_method_options)
self.shell_logging_compress = self._load_config_bool(shell_logging_data, 'enable_log_compression', self.shell_logging_compress)

# Desktop section
desktop_data = config_data.get("desktop", {})
self.desktop_default_enable = self._load_config_bool(desktop_data, 'enabled_by_default', self.desktop_default_enable)
self.desktop_default_proto = self._load_config_str(desktop_data, 'default_proto', self.desktop_default_proto, choices=self.desktop_available_proto)
self.desktop_default_localhost = self._load_config_bool(desktop_data, 'localhost_by_default', self.desktop_default_localhost)

def get_configs(self) -> List[str]:
"""User configs getter each options"""
configs = [
Expand All @@ -118,6 +140,9 @@ def get_configs(self) -> List[str]:
f"Default start shell: [blue]{self.default_start_shell}[/blue]",
f"Shell logging method: [blue]{self.shell_logging_method}[/blue]",
f"Shell logging compression: {boolFormatter(self.shell_logging_compress)}",
f"Desktop enabled by default: {boolFormatter(self.desktop_default_enable)}",
f"Desktop default protocol: [blue]{self.desktop_default_proto}[/blue]",
f"Desktop default host: [blue]{'localhost' if self.desktop_default_localhost else '0.0.0.0'}[/blue]",
]
# TUI can't be called from here to avoid circular importation
return configs
2 changes: 1 addition & 1 deletion exegol/console/ExegolPrompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def Confirm(question: str, default: bool) -> bool:
"""Quick function to format rich Confirmation and options on every exegol interaction"""
default_text = "[bright_magenta][Y/n][/bright_magenta]" if default else "[bright_magenta]\[y/N][/bright_magenta]"
default_text = "[bright_magenta][Y/n][/bright_magenta]" if default else "[bright_magenta][y/N][/bright_magenta]"
formatted_question = f"[bold blue][?][/bold blue] {question} {default_text}"
return rich.prompt.Confirm.ask(
formatted_question,
Expand Down
Loading
Loading