Skip to content

v0.9.2

Choose a tag to compare

@snonux snonux released this 17 Sep 05:41
· 509 commits to main since this release

Release v0.9.2

Release Notes

This release adds fleet-level introspection to the gonf API, letting recipes enumerate the hosts belonging to a fleet and safely look up per-host values during configuration authoring. Together with the new MustMapValue helper, these additions make it straightforward to drive per-host settings (such as staggered cron schedules) from a fleet definition.

Features

FleetRef.HostNames()

A new method on FleetRef returns the inventory names of the hosts in a fleet, in registration order:

names := api.MustFleet("web").HostNames()

Why this matters: Previously, recipes had no way to programmatically ask a fleet which hosts it contained, which made it awkward to write loops that apply host-specific configuration. With HostNames(), you can iterate over a fleet and emit per-host resources (files, cron entries, services) from a single recipe. Like other Must* accessors, an unregistered fleet handle fails fast via logger.Fatal, surfalling missing-inventory mistakes at registration time rather than at apply time.

MustMapValue generic map lookup

A new generic helper in api:

window := api.MustMapValue(cronWindows, hostName, "cron window")

It returns the value for a given key, or aborts the recipe via logger.Fatal when the key is missing.

Why this matters: When you drive per-host settings from a map (e.g. a per-host cron schedule keyed by host name), a fleet host added without a corresponding map entry would otherwise silently fall back to a default and apply the wrong configuration. MustMapValue follows the same fail-fast contract as MustHost and MustFleet, so a host missing from the map aborts the recipe before apply — catching inventory/config drift loudly and early.

Improvements

Hosts() now round-trips Port and Privilege

The Hosts() registry query is now exercised (and verified) to carry each host's SSH port and privilege mode (sudo/doas) through to the returned HostInfo values.

Why this matters: Callers that build host lists or reports from Hosts() can now see the full connection and privilege picture per host rather than a partial one. The release also pins down the intended behavior that a host without an explicit WithSSHPort reports Port as 0 — an important distinction, since SSH omits -p for port 0 and falls back to ~/.ssh/config. Surfacing the zero value lets callers detect a missing explicit port instead of silently inheriting a local SSH config default.

Testing

  • Expanded fleet registry tests to cover port and privilege round-tripping through Hosts(), registration-order preservation in HostNames(), and the MustMapValue helper.

Note: This release adds new API surface only; no existing behavior changes. There are no breaking changes or migration steps required.