From 3e295869cc4fdefc1237f775f93e805a2921c5a2 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 8 Jul 2025 16:31:51 +0200 Subject: [PATCH] api/disk_schema: make getter consistent --- pkgs/clan-cli/clan_lib/api/disk.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/api/disk.py b/pkgs/clan-cli/clan_lib/api/disk.py index 0fb083402..755e10a5e 100644 --- a/pkgs/clan-cli/clan_lib/api/disk.py +++ b/pkgs/clan-cli/clan_lib/api/disk.py @@ -73,9 +73,16 @@ templates: dict[str, dict[str, Callable[[dict[str, Any]], Placeholder]]] = { @API.register -def get_disk_schemas(machine: Machine) -> dict[str, DiskSchema]: +def get_machine_disk_schemas(machine: Machine) -> dict[str, DiskSchema]: """ - Get the available disk schemas + Get the available disk schemas. + This function reads the disk schemas from the templates directory and returns them as a dictionary. + Offering options based on the hardware report of the machine. + + :param machine: The machine to get the disk schemas for + :return: A dictionary of disk schemas, keyed by schema name + + :raises ClanError: If the hardware configuration is missing or invalid """ disk_templates = clan_templates(TemplateType.DISK) disk_schemas = {} @@ -155,7 +162,7 @@ def set_machine_disk_schema( raise ClanError(msg) # Check that the placeholders are valid - disk_schema = get_disk_schemas(machine)[schema_name] + disk_schema = get_machine_disk_schemas(machine)[schema_name] # check that all required placeholders are present for placeholder_name, schema_placeholder in disk_schema.placeholders.items(): if schema_placeholder.required and placeholder_name not in placeholders: