site serve and view: name the known sites when the id is missing or unknown #248
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
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
allod/tools#248
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Let someone who does not know a site's id find it from
allod siteitself, so a first use ofallod site viewdoes not end in reading the registry file by hand.Primary goals:
allod site viewandallod site serve --vm <name>with no site print the ids that have a preview, with their ports, beside the usage.unknown sitenames the known sites, and says which one is closest when one is.Current state
The id is the key of the repository's entry in
scripts/repositories.jsonof the inventory. Nothing prints those keys. A site's id is its registry key, not its domain and not a shortened name, so a guess from the site's name fails.Observed on a hypervisor, for a site the registry lists with a
preview_port:Neither message says what a valid id looks like or which ones exist. The second names a file, which is correct and leaves the reader to open it and find the key.
Receipts, at
3f917eb:cmd/allod/site_view.go:27,site view needs a site idcmd/allod/site_view.go:31andcmd/allod/site_serve.go:145,unknown sitecmd/allod/site_serve.go:89,--vm needs a site idcmd/allod/registry.go:62,registryEntries, which already holds every entry, andregistry.go:28,previewPortDefault
The list is the registry's entries that carry a
preview_port, sorted by id, one per line with the port. Withview, and wherevm-specs.jsonis readable, each line also names the machine that lists the site, since that is the other valueviewresolves. A registry with no such entry says so in one line.For
unknown site, the closest id is offered only when exactly one known id contains the given text or is within a small edit distance of it; otherwise the list alone.A separate
allod site listcommand is the alternative. It is left as a follow-up: the two error paths are where the reader is when they need the list.Validation
Scope
In: the two messages, the help text, their tests. Out: which registry a dev VM reads, tracked in allod/archetypes#119; a fallback port, filed separately.