infrahubctl schema
Manage the schema in a remote Infrahub instance.
Usage:
$ infrahubctl schema [OPTIONS] COMMAND [ARGS]...
Options:
--install-completion: Install completion for the current shell.--show-completion: Show completion for the current shell, to copy it or customize the installation.--help: Show this message and exit.
Commands:
load: Load one or multiple schema files into Infrahub.check: Check if schema files are valid and their impact on Infrahub.export: Export the schema from Infrahub as YAML...list: List all available schema kinds.show: Show details for a specific schema kind.format: Format Infrahub schema files with a...
infrahubctl schema load​
Load one or multiple schema files into Infrahub.
Usage:
$ infrahubctl schema load [OPTIONS] SCHEMAS...
Arguments:
SCHEMAS...: [required]
Options:
--debug / --no-debug: [default: no-debug]--branch TEXT: Branch on which to load the schema.--wait INTEGER: Time in seconds to wait until the schema has converged across all workers [default: 0]--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.
infrahubctl schema check​
Check if schema files are valid and what would be the impact of loading them with Infrahub.
Usage:
$ infrahubctl schema check [OPTIONS] SCHEMAS...
Arguments:
SCHEMAS...: [required]
Options:
--debug / --no-debug: [default: no-debug]--branch TEXT: Branch on which to check the schema.--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.
infrahubctl schema export​
Export the schema from Infrahub as YAML files, one per namespace.
Usage:
$ infrahubctl schema export [OPTIONS]
Options:
--directory PATH: Directory path to store schema files [default: (dynamic)]--branch TEXT: Branch from which to export the schema--namespaces TEXT: Namespace(s) to export (default: all user-defined)--debug / --no-debug: [default: no-debug]--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.
infrahubctl schema list​
List all available schema kinds.
Displays a table of all node schema entries. Use --filter to narrow results by a case-insensitive match on the kind name.
Examples: infrahubctl schema list infrahubctl schema list --filter Device
Usage:
$ infrahubctl schema list [OPTIONS]
Options:
--filter TEXT: Filter kinds by name-b, --branch TEXT: Target branch--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.
infrahubctl schema show​
Show details for a specific schema kind.
Displays metadata, attributes, and relationships for the requested schema kind in a human-readable format.
Examples: infrahubctl schema show InfraDevice
Usage:
$ infrahubctl schema show [OPTIONS] KIND
Arguments:
KIND: Schema kind to display [required]
Options:
-b, --branch TEXT: Target branch--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.
infrahubctl schema format​
Format Infrahub schema files with a canonical key ordering.
Reorders the keys within each node, generic, attribute, relationship and dropdown choice into a consistent, opinionated order so schema files read the same way and produce small diffs.
Only your own nodes are formatted; nodes in Infrahub-reserved namespaces are left untouched. Comments, quoting, and inline (flow) sequences are preserved.
By default the change is purely key ordering. The opt-in flags additionally change content: --strip-defaults drops redundant default values, --sort-by-order-weight reorders attributes/relationships, and --backfill-order-weight fills in a missing order_weight.
Examples: infrahubctl schema format schemas/ infrahubctl schema format schemas/dcim.yml --diff infrahubctl schema format schemas/ --check infrahubctl schema format schemas/ --strip-defaults --sort-by-order-weight
Usage:
$ infrahubctl schema format [OPTIONS] SCHEMAS...
Arguments:
SCHEMAS...: [required]
Options:
--check: Do not write files; exit 1 if any file would be reformatted.--diff: Print a diff of the changes instead of writing files.--strip-defaults: Remove attribute/relationship/node keys whose value equals the schema default.--sort-by-order-weight: Sort attributes and relationships by order_weight (items without one keep their order and go last).--backfill-order-weight: Give attributes/relationships that lack an order_weight the value 1000.--config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]--help: Show this message and exit.