Repository navigation
Test machine-media.mjs, and fix a hostname that could end in a hyphen - #9
Merged
MyOwnDataCenter merged 2 commits intoNov 14, 2026
Merged
Conversation
…answer file omarchyd/machine-media.mjs builds what a new machine installs itself from, and had only one partial test inside machines.test.mjs. test/machine-media.test.mjs covers every export: - hostnameFor: cleaning, the 63 character limit and the machine-<id> fallback. - PUBLIC_KEY and cloudUserData: only public keys get in (a private key, a quote in the comment and a second line are refused), groups, shell, the password line and the chpasswd block, and package names and commands from the catalog checked before they are written. - cloudMetaData: a new instance id every time. - omarchyConfiguration and omarchyCredentials: one disk, the boot partition, the Btrfs subvolumes and room left at the end of the disk. - isWindowsLabel and isWindowsClientLabel. - windowsAnswerFile: computer name cleaned and cut to 15 characters, XML escaping of the user name and product key, and a password that decodes back to UTF-16LE(password + "Password") even with accents, never in plain text. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR
A machine's name can be up to 64 characters. hostnameFor cut the cleaned name to 63 characters after it had already trimmed hyphens from the ends, so a name like "<62 letters> b" became "<62 letters>-", which is not a valid hostname (a hostname cannot end in a hyphen). The cut now happens first, then trailing hyphens are trimmed again. Found by the new tests in test/machine-media.test.mjs. I have not checked what cloud-init does with such a name; the fix just keeps it valid. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR
Owner
|
Thank you, this is excellent work: careful tests, and a real bug found and fixed. Splitting the tests and the fix into two commits made it easy to verify. Accepted and merged. What I checked:
This finishes #6. Good spot on Generated by Claude Code |
MyOwnDataCenter
pushed a commit
that referenced
this pull request
Nov 14, 2026
- omarchyd used <data>/tls while the web server used ~/.local/share/ omarchy-server/tls, so app gateways served a certificate from a different authority than the one devices trust, and Security settings (always https, replace certificate) only reached omarchyd. omarchyd/cli.mjs now passes defaultTlsDir(); an "always https" choice from the old folder is carried over. - omarchyd/prompt.mjs: the create-owner prompt reads input character by character, so a pasted password with its Enter (or both passwords at once) works (reported by nixfred in #10). - cloudUserData ignores a non-list `commands` (noted by nixfred in #9). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011b9fuB8ePE7DYtvvqNj1s2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds tests for
omarchyd/machine-media.mjs, the module that builds what a new machine installs itself from (cloud-init, the Omarchy ISO's disk layout, the Windows answer file). It was the one module issue #6 was kept open for.They found one bug, fixed in the second commit: a machine name can be 64 characters, and
hostnameForcut the cleaned name to 63 characters after it had already trimmed hyphens, so<62 letters> bbecame<62 letters>-, which is not a valid hostname. The cut now happens first, then trailing hyphens are trimmed.How you tested it
npm run typecheck,npm run buildandnpm testpass (133 tests, 9 of them new)hostnameFor, which names new machines, and I have not created a machine with a 64-character name.Anything to know
main('aaaa…a-'instead of'aaaa…a') and passes with it.cloudUserDatachecks thatpackagesis a list but notcommands, so a catalog entry withcommands: "x"would throw. Only the repo's own catalog file can do that, so I did not change it here.Closes #6
🤖 Generated with Claude Code
https://claude.ai/code/session_01BXN1v3McRXvDta1mtsKJkR