- Added `guest_tools.py` for standalone tool installer functionality. - Introduced `ToolJobStore` in `tool_store.py` to manage per-VM tool job records. - Created `ToolService` in `tools.py` for background installation workers using the guest execution channel. - Enhanced `LifecycleService` in `lifecycle.py` to support tool installation queuing and preparation. - Updated `guest_exec.py` to handle connection shutdown gracefully. - Added validation and normalization functions for tool specifications. - Implemented logging and error handling for tool installation processes. - Ensured compatibility with Ubuntu 22.04 and ARM64/x86_64 architectures.
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
"""Application composition root for the uvm command-line executable."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Callable
|
|
from dataclasses import dataclass
|
|
|
|
from .config import Settings
|
|
from .firecracker.process import FirecrackerProcessManager
|
|
from .images import ImageStore
|
|
from .install import Installer
|
|
from .known_hosts import KnownHostsManager
|
|
from .lifecycle import LifecycleService
|
|
from .network import NetworkManager
|
|
from .state import StateStore
|
|
from .system import CommandRunner
|
|
from .tools import ToolService
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class Application:
|
|
"""Concrete host services used by the CLI; this is not a public SDK."""
|
|
|
|
settings: Settings
|
|
state_store: StateStore
|
|
installer: Installer
|
|
lifecycle: LifecycleService
|
|
tools: ToolService | None = None
|
|
|
|
|
|
def build_application(emit: Callable[[str], None] | None = print) -> Application:
|
|
settings = Settings.from_environment()
|
|
runner = CommandRunner(emit=emit)
|
|
state_store = StateStore(settings)
|
|
images = ImageStore(settings, runner)
|
|
network = NetworkManager(settings, runner)
|
|
process = FirecrackerProcessManager(settings)
|
|
known_hosts = KnownHostsManager(settings)
|
|
lifecycle = LifecycleService(settings, state_store, images, network, process, known_hosts=known_hosts)
|
|
installer = Installer(settings, runner, state_store, emit=emit)
|
|
return Application(
|
|
settings=settings,
|
|
state_store=state_store,
|
|
installer=installer,
|
|
lifecycle=lifecycle,
|
|
tools=ToolService(settings, state_store, lifecycle),
|
|
)
|