exegol.model package

Submodules

exegol.model.ContainerConfig module

class exegol.model.ContainerConfig.ContainerConfig(container: Optional[docker.models.containers.Container] = None)

Bases: object

Configuration class of an exegol container

addDevice(device_source: str, device_dest: Optional[str] = None, readonly: bool = False, mknod: bool = False)

Add a device to the container configuration

addEnv(key: str, value: str)

Add an environment variable to the container configuration

addPort(port_host: Union[int, str], port_container: Union[int, str], protocol: str = 'tcp', host_ip: str = '0.0.0.0')

Add port NAT config, only applicable on bridge network mode.

addRawEnv(env: str)

Parse and add an environment variable from raw user input

addRawVolume(volume_string)

Add a volume to the container configuration from raw text input. Expected format is: /source/path:/target/mount:rw

addVolume(host_path: str, container_path: str, read_only: bool = False, volume_type: str = 'bind')

Add a volume to the container configuration

disableDefaultWorkspace()

Allows you to disable the default workspace volume

disableExegolResources()

Procedure to disable exegol resources volume feature (Only for interactive config)

enableCwdShare()

Procedure to share Current Working Directory with the /workspace of the container

enableExegolResources() bool

Procedure to enable exegol resources volume feature

enableGUI()

Procedure to enable GUI feature

enableSharedResources()

Procedure to enable shared volume feature

enableSharedTimezone()

Procedure to enable shared timezone feature

enableVPN(config_path: Optional[str] = None)

Configure a VPN profile for container startup

getCapabilities() List[str]

Capabilities getter

getContainerCommand() str

Get container entrypoint path

getDevices() List[str]

Devices config getter

getEnvs() Dict[str, str]

Envs config getter

getHostWorkspacePath() str

Get private volume path (None if not set)

getNetworkMode() str

Network mode, text getter

getPorts() Dict[str, Optional[Union[int, Tuple[str, int], List[int]]]]

Ports config getter

getPrivateVolumePath() str

Get private volume path (None if not set)

getPrivileged() bool

Privileged getter

getShellEnvs() List[str]

Overriding envs when opening a shell

getSysctls() Dict[str, str]

Sysctl custom rules getter

getTextDevices(verbose: bool = False) str

Text formatter for Devices configuration. The verbose mode show full device configuration.

getTextEnvs(verbose: bool = False) str

Text formatter for Envs configuration. The verbose mode does not exclude technical variables.

getTextFeatures(verbose: bool = False) str

Text formatter for features configurations (Privileged, GUI, Network, Timezone, Shares) Print config only if they are different from their default config (or print everything in verbose mode)

getTextMounts(verbose: bool = False) str

Text formatter for Mounts configurations. The verbose mode does not exclude technical volumes.

getVolumes() List[docker.types.services.Mount]

Volume config getter

getVpnName()

Get VPN Config name

getWorkingDir() str

Get default container’s default working directory path

interactiveConfig(container_name: str) List[str]

Interactive procedure allowing the user to configure its new container

isExegolResourcesEnable() bool

Return if the feature ‘exegol resources’ is enabled in this container config

isGUIEnable() bool

Return if the feature ‘GUI’ is enabled in this container config

isSharedResourcesEnable() bool

Return if the feature ‘shared resources’ is enabled in this container config

isTimezoneShared() bool

Return if the feature ‘timezone’ is enabled in this container config

isWorkspaceCustom() bool

Return if the workspace have a custom host volume

prepareShare(share_name: str)

Add workspace share before container creation

printConfig()

Log current object state, debug only

removeDevice(device_source: str) bool

Remove a device from the container configuration (Only before container creation)

removeEnv(key: str) bool

Remove an environment variable to the container configuration (Only before container creation)

removeVolume(host_path: Optional[str] = None, container_path: Optional[str] = None) bool

Remove a volume from the container configuration (Only before container creation)

setContainerCommand(cmd: str)

Set the entrypoint command of the container. This command is executed at each startup. This parameter is applied to the container at creation.

setNetworkMode(host_mode: bool)

Set container’s network mode, true for host, false for bridge

setPrivileged(status: bool = True)

Set container as privileged

setWorkspaceShare(host_directory)

Procedure to share a specific directory with the /workspace of the container

exegol.model.ExegolContainer module

class exegol.model.ExegolContainer.ExegolContainer(docker_container: docker.models.containers.Container, model: Optional[exegol.model.ExegolContainerTemplate.ExegolContainerTemplate] = None)

Bases: exegol.model.ExegolContainerTemplate.ExegolContainerTemplate, exegol.model.SelectableInterface.SelectableInterface

Class of an exegol container already create in docker

exec(command: Sequence[str], as_daemon: bool = True)

Execute a command / process on the docker container

static formatShellCommand(command: Sequence[str])

Generic method to format a shell command and support zsh aliases

getFullId() str

Container’s id getter

getId() str

Container’s short id getter

getKey() str

Universal unique key getter (from SelectableInterface)

getRawStatus() str

Raw text getter of the container status

getTextStatus() str

Formatted text getter of the container status

isNew() bool

Check if the container has just been created or not

isRunning() bool

Check is the container is running. Return bool.

postStartSetup()
remove()

Stop and remove the docker container

spawnShell()

Spawn a shell on the docker container

start()

Start the docker container

stop(timeout: int = 10)

Stop the docker container

exegol.model.ExegolContainerTemplate module

class exegol.model.ExegolContainerTemplate.ExegolContainerTemplate(name: Optional[str], config: exegol.model.ContainerConfig.ContainerConfig, image: exegol.model.ExegolImage.ExegolImage)

Bases: object

Exegol template class used to create a new container

prepare()

Prepare the model before creating the docker container

exegol.model.ExegolImage module

class exegol.model.ExegolImage.ExegolImage(name: str = 'NONAME', digest: Optional[str] = None, image_id: Optional[str] = None, size: int = 0, docker_image: Optional[docker.models.images.Image] = None, isUpToDate: bool = False)

Bases: exegol.model.SelectableInterface.SelectableInterface

Class of an exegol image. Container every information about the docker image.

getBuildDate()

Build date getter

getDisplayName() str

Image’s display name getter

getDownloadSize() str

Remote size getter

getFullName() str

Dockerhub image’s full name getter

getFullVersionName() str

Dockerhub image’s full (installed) version name getter

getImageVersion() str

Image’s tag version getter

getInstalledVersionName() str

Image’s tag name with latest version getter

getKey() str

Universal unique key getter (from SelectableInterface)

getLatestVersion() str

Latest image version getter

getLatestVersionName() str

Image’s tag name with latest version getter

getLocalId() str

Local id getter

getName() str

Image’s tag name getter

getRealSize() str

On-Disk size getter

getRemoteId() str

Remote digest getter

getSize() str

Image size getter. If the image is installed, return the on-disk size, otherwise return the remote size

getStatus(include_version: bool = True) str

Formatted text getter of image’s status. Parameter include_version allow choosing if the image version must be printed or not. When image version is already print in the user context, no need to duplicate the information. The status update available always print his version because the latest version is not print elsewhere.

getType() str

Image type getter

isInstall() bool

Installation status getter

isLocal() bool

Local type getter

isLocked() bool

Getter locked status. If current image is locked, it must be removed

isUpToDate() bool
isVersionSpecific() bool

Is the current image a version specific version? Image version specific container a ‘-’ in the name, latest image don’t.

classmethod mergeImages(remote_images: List[exegol.model.ExegolImage.ExegolImage], local_images: List[docker.models.images.Image]) List[exegol.model.ExegolImage.ExegolImage]

Compare and merge local images and remote images. Use case to process :

  • up-to-date : “Version specific” image can use exact digest_id matching. Latest image must match corresponding tag

  • outdated : Don’t match digest_id but match (latest) tag

  • local image : don’t have any ‘RepoDigests’ because they are local

  • discontinued : image with ‘RepoDigests’ properties but not found in remote

  • unknown : no internet connection = no information from the registry

  • not install : other remote images without any match

Return a list of ExegolImage.

removeCheck() Optional[str]

If this image can be removed, return its name, otherwise return None

classmethod reorderImages(images: List[exegol.model.ExegolImage.ExegolImage]) List[exegol.model.ExegolImage.ExegolImage]

Reorder ExegolImages depending on their status

setCustomStatus(status: str)

Manual image’s status overwrite

setDockerObject(docker_image: docker.models.images.Image)

Docker object setter. Parse object to set up self configuration.

syncContainerData(container: docker.models.containers.Container)

Synchronization between the container and the image. If the image has been updated, the tag is lost, but it is saved in the properties of the container that still uses it.

syncStatus()

When the image is loaded from a docker object, docker repository metadata are not present. It’s not (yet) possible to know if the current image is up-to-date.

updateCheck() Optional[str]

If this image can be updated, return its name, otherwise return None

exegol.model.ExegolModules module

class exegol.model.ExegolModules.ExegolModules(*args, **kwargs)

Bases: object

Singleton class dedicated to the centralized management of the project modules

getResourcesGit(fast_load: bool = False, skip_install: bool = False) exegol.utils.GitUtils.GitUtils

GitUtils resource repo/submodule singleton getter. Set fast_load to True to disable submodule init/update. Set skip_install to skip to installation process of the modules if not available. if skip_install is NOT set, the CancelOperation exception is raised if the installation failed.

getSourceGit(fast_load: bool = False) exegol.utils.GitUtils.GitUtils

GitUtils source submodule singleton getter. Set fast_load to True to disable submodule init/update.

getWrapperGit(fast_load: bool = False) exegol.utils.GitUtils.GitUtils

GitUtils local singleton getter. Set fast_load to True to disable submodule init/update.

isExegolResourcesReady() bool

Update Exegol-resources from git (submodule)

exegol.model.SelectableInterface module

class exegol.model.SelectableInterface.SelectableInterface

Bases: object

Generic class used to select objects in the user TUI

getKey() str

Universal unique key getter

Module contents