From d55074c7c92d03d5374a961c4473b37d308ae098 Mon Sep 17 00:00:00 2001 From: Tim Ross Date: Wed, 10 Jul 2024 19:27:31 -0400 Subject: [PATCH] Print accurate status in tsh login output If tsh login was executed while the user had a valid session the resulting status shown to the user included data from the prior session. The root cause was the profile being passed to printLoginInformation was the old. Any profiles retrieved prior to calling (TeleportClient)SaveProfile should be discarded and the profile should be retrieved again to reflect the new session. Closes https://github.com/gravitational/teleport/issues/33732. --- tool/tsh/common/tsh.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tool/tsh/common/tsh.go b/tool/tsh/common/tsh.go index faaeb2878c4a..485178425e9f 100644 --- a/tool/tsh/common/tsh.go +++ b/tool/tsh/common/tsh.go @@ -1869,6 +1869,11 @@ func onLogin(cf *CLIConf) error { return trace.Wrap(err) } + profile, profiles, err = cf.FullProfileStatus() + if err != nil { + return trace.Wrap(err) + } + // Print status to show information of the logged in user. return trace.Wrap(printLoginInformation(cf, profile, profiles, cf.getAccessListsToReview(tc))) // proxy is unspecified or the same as the currently provided proxy,