Skip to content

fix(agent): fall back to random machine-id when setup fails#6

Merged
CMGS merged 1 commit into
mainfrom
fix/machine-id-fallback
Jul 3, 2026
Merged

fix(agent): fall back to random machine-id when setup fails#6
CMGS merged 1 commit into
mainfrom
fix/machine-id-fallback

Conversation

@CMGS

@CMGS CMGS commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review follow-up on #4: regenMachineID truncates /etc/machine-id then runs systemd-machine-id-setup; if the tool exists but fails, the guest was left with an empty machine-id (error returned, damage done). Any setup failure now falls through to writeRandomMachineID() — the same random 32-hex the tool itself generates absent other sources. Only if that write also fails does an error (and the empty file) surface.

lint 0 issues × 3 GOOS, tests green. No dedicated unit test: the branch writes the real /etc/machine-id; making the path injectable for a 3-line fallback would be overdesign.

…tup fails

regenMachineID truncates /etc/machine-id before running the setup tool;
a setup failure previously returned an error with the file left empty.
Now any setup failure falls through to writeRandomMachineID, which is
what the tool would generate anyway absent other sources.
@CMGS CMGS merged commit 9d92adc into main Jul 3, 2026
2 checks passed
@CMGS CMGS deleted the fix/machine-id-fallback branch July 3, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant