LegacyConfigAdapter

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class LegacyConfigAdapter[source]

Bases: object

Translate frozen v0 YAML mappings into the v1 document model.

The adapter is stateless: one instance serves every workflow. The v0 schema is frozen, so the translation table is a fixed, reviewable mapping rather than open-ended introspection.

SCHEMA_VERSION = '1.0'

Version tag emitted into translated documents.

translate(payload: Mapping[str, Any], workflow: str) → LegacyTranslation[source]

Translate one v0 payload into the v1 document layout.

Parameters:
  • payload – Top-level v0 YAML mapping.

  • workflow – Workflow alias, e.g. "habitat" or "model".

Returns:

The translation result holding the v1 document, the verbatim legacy remainder, and warnings.

Raises:

HABITAPIError – On a non-mapping payload or an unknown workflow.