docs/api: add docstrings to {get_flash_options, run_machine_flash}

This commit is contained in:
Johannes Kirschbauer
2025-07-07 15:34:49 +02:00
parent 0699dd6fb3
commit a99ab3d3ca
2 changed files with 21 additions and 0 deletions

View File

@@ -49,6 +49,21 @@ def run_machine_flash(
extra_args: list[str] | None = None,
graphical: bool = False,
) -> None:
"""Flash a machine with the given configuration.
Args:
machine: The Machine instance to flash.
mode: The mode to use for flashing (e.g., "install", "reinstall
disks: List of Disk instances representing the disks to flash.
system_config: SystemConfig instance containing language, keymap, and SSH keys.
dry_run: If True, perform a dry run without making changes.
write_efi_boot_entries: If True, write EFI boot entries.
debug: If True, enable debug mode.
extra_args: Additional arguments to pass to the disko-install command.
graphical: If True, run the command in graphical mode.
Raises:
ClanError: If the language or keymap is invalid, or if there are issues with
reading SSH keys, or if disko-install fails.
"""
devices = [Path(disk.device) for disk in disks]
with pause_automounting(devices, machine, request_graphical=graphical):
if extra_args is None:

View File

@@ -19,6 +19,12 @@ class FlashOptions(TypedDict):
@API.register
def get_flash_options() -> FlashOptions:
"""Retrieve available languages and keymaps for flash configuration.
Returns:
FlashOptions: A dictionary containing lists of available languages and keymaps.
Raises:
ClanError: If the locale file or keymaps directory does not exist.
"""
return {"languages": list_languages(), "keymaps": list_keymaps()}