Skip to content

Commit

Permalink
tctl: fix error reporting when server is down (#29281) (#29324)
Browse files Browse the repository at this point in the history
A regresion in #25780 changed text that used to be reported to
standard output to go to the logger instead. Since the logger
output is only visible when the debug flag is set, this caused
a fatal error to go unreported to the user.

Fixes #28129
  • Loading branch information
zmb3 committed Jul 19, 2023
1 parent a66eab9 commit c9b322d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tool/tctl/common/tctl.go
Expand Up @@ -192,9 +192,10 @@ func TryRun(commands []CLICommand, args []string) error {
if utils.IsUntrustedCertErr(err) {
err = trace.WrapWithMessage(err, utils.SelfSignedCertsMsg)
}
log.Errorf("Cannot connect to the auth server. Is the auth server running on %q? %v",
cfg.AuthServerAddresses()[0].Addr, err)
return trace.NewAggregate(&toolcommon.ExitCodeError{Code: 1}, err)
fmt.Fprintf(os.Stderr,
"ERROR: Cannot connect to the auth server. Is the auth server running on %q?\n",
cfg.AuthServerAddresses()[0].Addr)
return trace.NewAggregate(&common.ExitCodeError{Code: 1}, err)
}

// execute whatever is selected:
Expand Down

0 comments on commit c9b322d

Please sign in to comment.