Repository navigation
fix(install): show the setup code, and exit 0 when there is none - #2
Merged
Merged
Conversation
The setup code is rand.Text()[:12], which uses the URL-safe base64 alphabet, so it usually contains lowercase letters. The parser only matched [A-Z0-9] and reported an empty code, dropping the line the installer prints after a first run.
The trailing "[ -n "$code" ] && say" is the last command in the script, so an empty code made the installer return 1 even though the install worked. A failing exit status from curl | sudo sh reads as a failed deploy in anything that checks it.
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.
Two small fixes to the setup-code line at the end of
deploy/install.sh.1. The installer never prints the code it extracts.
install.shpulls the code out of the journal with[A-Z0-9]*, but the code isrand.Text()[:12](cmd/heron/main.go:212), andcrypto/rand.Text()uses the URL-safe base64 alphabet[A-Za-z0-9_-]— so it usually contains lowercase letters. The capture group matches zero characters,codeends up empty, and the guard on the next line drops the message.Reproduced against both log shapes (the text handler is the default,
cmd/heron/main.go:120; JSON is opt-in throughlog_format):The JSON form
{"setup_code":"aB3dEf9gHi2X"}behaves the same way, so widening the class fixes both.2. An empty code made a successful install exit 1.
[ -n "$code" ] && say "setup code: $code"is the last command in the file, so whencodeis empty the script's exit status is 1 — verified on bash, dash and sh. Nothing aborts (set -eignores a failing AND-list), butcurl -fsSL ... | sudo shfrom the README now reports failure for an install that worked, which is exactly what a CI job or a wrapping script withpipefailwill read as a broken deploy. Turning it into anifblock keeps the same output and returns 0:sh -n deploy/install.shpasses on bash, dash and sh after the change.Left alone after checking, because they are fine:
heron user reset-2fareally is implemented (cmd/heron/main.go:424), andStateDirectory=heronindeploy/heron.servicecreates/var/lib/heron, so the installer does not need an explicitmkdir.