docs/api: add docstrings to {get_flash_options, run_machine_flash}
This commit is contained in:
@@ -49,6 +49,21 @@ def run_machine_flash(
|
|||||||
extra_args: list[str] | None = None,
|
extra_args: list[str] | None = None,
|
||||||
graphical: bool = False,
|
graphical: bool = False,
|
||||||
) -> None:
|
) -> 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]
|
devices = [Path(disk.device) for disk in disks]
|
||||||
with pause_automounting(devices, machine, request_graphical=graphical):
|
with pause_automounting(devices, machine, request_graphical=graphical):
|
||||||
if extra_args is None:
|
if extra_args is None:
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ class FlashOptions(TypedDict):
|
|||||||
|
|
||||||
@API.register
|
@API.register
|
||||||
def get_flash_options() -> FlashOptions:
|
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()}
|
return {"languages": list_languages(), "keymaps": list_keymaps()}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user