2 Technical_Decomp_Manifest
Miguel Jacq edited this page 2025-12-27 20:58:36 -06:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

enroll/manifest.py

manifest.manifest() is the consumer:

  • reads state.json and turns those snapshot + managed file records into Ansible roles
  • optionally runs jinjaturtle, producing JinjifyResult per templated file
  • uses _IndentDumper to format YAML cleanly

_IndentDumper (inner class inside _yaml_dump_mapping)

Purpose: makes PyYAML output indentation match stricter linters/Ansible expectations.

What it subclasses:

yaml.SafeDumper

Override:

  • increase_indent(self, flow=False, indentless=False)
  • it forces indentless=False when calling the superclass, which prevents PyYAMLs common behavior of emitting:
key:
- item
  • and instead prefers:
key:
  - item

Lifecycle / where its used:

Only used when PyYAML is available.

manifest uses _yaml_dump_mapping() for:

  • role defaults (defaults/main.yml)
  • host_vars role data (inventory/host_vars/...)
  • ensuring stable formatting.