Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling in tbot start #11756

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fail on non-NotFound errors while reading an Identity.
  • Loading branch information
timothyb89 committed Apr 7, 2022
commit 9cc35dcc53674775b15e0d293ddc070040ac0d86
6 changes: 4 additions & 2 deletions tool/tbot/main.go
Original file line number Diff line number Diff line change
@@ -208,10 +208,12 @@ func onStart(botConfig *config.BotConfig) error {
if ident != nil {
// If ident is set here, we detected a token change above.
log.Warnf("Detected a token change, will attempt to fetch a new identity.")
} else {
} else if trace.IsNotFound(err) {
// This is _probably_ a fresh start, so we'll log the true error
// and try to fetch a fresh identity.
log.Debugf("Identity %s could not be loaded, will start from scratch: %+v", dest, err)
log.Debugf("Identity %s is not found or empty and could not be loaded, will start from scratch: %+v", dest, err)
} else {
return trace.Wrap(err)
}

// TODO: validate that errors from LoadIdentity are sanely typed; we