Add networkctl fact #573

Merged
benvin merged 1 commits from benvin/networkctl-fact into develop 2026-11-15 18:35:21 +11:00
Member

Hosts running systemd-networkd expose link, address, route and DNS state only through networkctl, so none of it is visible in PuppetDB for querying or reporting.

  • add networkctl fact from networkctl --json=short, keyed by interface name
  • confine to Linux hosts with networkctl and a running networkd (/run/systemd/netif)
  • return nil on missing output or parse failure so puppet runs never break
Hosts running systemd-networkd expose link, address, route and DNS state only through `networkctl`, so none of it is visible in PuppetDB for querying or reporting. - add `networkctl` fact from `networkctl --json=short`, keyed by interface name - confine to Linux hosts with `networkctl` and a running networkd (`/run/systemd/netif`) - return nil on missing output or parse failure so puppet runs never break
unkin-agent added 1 commit 2026-11-15 18:05:26 +11:00
Add networkctl fact
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/puppet-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was successful
a99be9f861
Author
Member
  • modules/libs/lib/facter/networkctl.rb:21 — networkctl --json=short is unsupported on systemd 239/252 (AlmaLinux 8/9, most of the estate); it errors, output is empty, fact is silently nil there, so the stated "why" is only met on newer systemd (Fedora/Debian) → confirm the target hosts run a networkctl with --json, or state in the PR body which OSes get the fact
  • modules/libs/lib/facter/networkctl.rb:10 — iface['Name'] can be nil, yielding a nil-keyed hash entry → nit: .reject { |i| i['Name'].nil? } or drop it
  • CI: ruby-check, ruby-validate and the other validate jobs were still pending on a99be9f → re-check before merge
- modules/libs/lib/facter/networkctl.rb:21 — `networkctl --json=short` is unsupported on systemd 239/252 (AlmaLinux 8/9, most of the estate); it errors, output is empty, fact is silently nil there, so the stated "why" is only met on newer systemd (Fedora/Debian) → confirm the target hosts run a networkctl with --json, or state in the PR body which OSes get the fact - modules/libs/lib/facter/networkctl.rb:10 — `iface['Name']` can be nil, yielding a nil-keyed hash entry → nit: `.reject { |i| i['Name'].nil? }` or drop it - CI: ruby-check, ruby-validate and the other validate jobs were still pending on a99be9f → re-check before merge
benvin merged commit efe15ec078 into develop 2026-11-15 18:35:21 +11:00
benvin deleted branch benvin/networkctl-fact 2026-11-15 18:35:21 +11:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/puppet-prod#573