host.factory¶
The host-dict factory: builds and validates RemoteHost
instances from raw lab-data host dicts, resolving os_type against the
otto.host.os_profile registry.
Host-dict factory: build and validate RemoteHost instances from raw config dicts.
-
otto.host.factory.create_host_from_dict(host_data: dict[str, Any], preferences: dict[str, dict[str, Any]] | None =
None) RemoteHost¶ Create the appropriate
RemoteHostsubclass from a host dict.os_typeselects the profile / class / spec.preferencesis the unified{selector: {capability_list | option_table}}table; for each host the factory cascades it byidinto capability selections (forwarded toto_host) and option-value defaults (merged per-key, product-wins). Withpreferences=Nonethe result is identical to a bare host dict.
- otto.host.factory.validate_host_dict(host_data: dict[str, Any]) None¶
Validate a host dict without constructing the host.
os_typemust name a registered profile; the profile’s base spec validates the merged dict (extra='forbid', required fields, typed coercion, family-specific field validators forcommand_frame/filesystem/transfer/docker_capable).Raises¶
- ValueError
If
os_typenames no registered profile.- pydantic.ValidationError
On any structural problem (subclass of
ValueError).