feat: the first boot asks the fully qualified domain name #36
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/inithooks!36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/first-boot-fqdn"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What. A new interactive first boot hook,
31fqdn, asks the machine's fully qualified domain name, prefilled with the name the machine has (pct create --hostname; a dotted name as it is). On Apply,/etc/keel/instance.yaml(or the file00declarativeread) recordsinstance.hostname,instance.fqdnandtls.acme.domains: [name]when it declares no domain yet (tls.acme.enabledis never touched; a hostname declared beside the unchanged name is kept; a description the answer does not change is not rewritten, and the file keeps its mode); then the first label becomes the hostname, set the way09hostnamesets it (the rename is nowlib/hostname.sh, sourced by both hooks, matching the old name literally as a whole name or a first label, where the sed matched it inside any word), and/etc/hostsgets the entry that makeshostname -fanswer the name, rewriting the line pct wrote for the host where it stands. The description comes first so a step that fails leaves one saying what the machine should be. A single label is kept as the hostname alone after a notice that no certificate can be requested without a domain; an empty answer keeps what the machine has. Lower case labels of letters, digits and dashes; anything else is refused and asked again.FQDNpreseeds it (instance.fqdnrenders it, so a described machine is not asked),FQDN=SKIPasks nothing.Why. The first boot never asked a domain, so confconsole's Let's Encrypt screen had nothing to offer but example.com. The maintainer wants confconsole driven by the spec: this records the name there (Keel-Linux/confconsole#22 reads it).
How the spec is written. keel exposes no writer (no command, no API); confconsole's
keelcli.pyis the only one, not importable from here.libinithooks/fqdn.pyfollows it: PyYAML (sort_keys=False, so the rest of the file is kept in order; comments do not survive, as with every confconsole write), a copy beside the file,keel spec validate --no-secret-fileson that copy when keel is installed, thenos.replace. Without keel the copy is moved in after this hook's own domain check.Decisions to note. Numbered 31: an interactive hook must be 30 or above (README;
runwaits for the boot from 30), and30rootpassstays the first screen. The hostname written is the first label, never the dotted name (askeel applydoes). The reader now acceptstls.acme.agree_tos, which keel's spec has and inithooks refused.Tested.
tests/test_fqdn.py(50) andtests/test_fqdn_cli.py(26) on the fake dialog, keel a stub on PATH;tests/test-hostname.bats(8) andtests/test-fqdn.bats(14), the last three running the realbin/fqdn.pywithFQDNpreseeded against a scratchinstance.yamland hosts file;test_dialog_brand.pycoversbin/fqdn.py. Python 99 percent (both new files 100), shell 99.62 (new files 100), measured as in COVERAGE.md. The dialog texts fit 60 columns and at most 17 rows.