coerce_spec

Note

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

coerce_spec(entry: Any) → Spec | None[source]

Coerce one component payload into a Spec.

Accepts the structured mapping form (name/params) and the compact string form (a strict feature-tree expression such as 'concat(raw("T1"), raw("T2"))'), so YAML documents may spell a feature component either way.

Parameters:

entry – The payload, or None.

Returns:

The coerced Spec, or None for an unset component.

Raises:

HABITAPIError – On a payload of any other type.