Skip to content

Fetch ClusterAlerts a single time during login#26903

Merged
rosstimothy merged 1 commit intomasterfrom
tross/login_cluster_alerts
May 30, 2023
Merged

Fetch ClusterAlerts a single time during login#26903
rosstimothy merged 1 commit intomasterfrom
tross/login_cluster_alerts

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy commented May 25, 2023

onLogin was inadvertently retrieving ClusterAlerts twice by explicitly retrieving them and by calling onStatus, which also gets the alerts so they are shown when tsh status is invoked. The portion of onStatus which prints the profile has been separated into outputProfiles so that onLogin may call that directly instead of onStatus.

Partly addresses #21841

@rosstimothy
Copy link
Copy Markdown
Contributor Author

tsh login trace from v13:
image

tsh login trace from this branch:
image

@rosstimothy rosstimothy marked this pull request as ready for review May 25, 2023 17:01
@github-actions github-actions Bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels May 25, 2023
@github-actions github-actions Bot requested review from Tener and r0mant May 25, 2023 17:02
@rosstimothy rosstimothy requested a review from zmb3 May 26, 2023 18:23
Comment thread tool/tsh/tsh.go Outdated
}
fmt.Println(out)
default:
printProfiles(cf.Debug, active, others, env, cf.Verbose)
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printProfiles sounds very similar to outputProfiles, and calling the wrong one may result in unexpected behavior.

What do you think about inlining the contents of printProfiles here, so there's only one function for printing profiles?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b01e59

@rosstimothy rosstimothy requested a review from zmb3 May 26, 2023 20:49
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from r0mant May 27, 2023 14:50
`onLogin` was inadvertently retrieving ClusterAlerts twice by
explicitly retrieving them and by calling `onStatus`, which also gets
the alerts so they are shown when `tsh status` is invoked. The portion
of `onStatus` which prints the profile has been separated into
`outputProfiles` so that `onLogin` may call that directly instead
of `onStatus`.
@rosstimothy rosstimothy force-pushed the tross/login_cluster_alerts branch from 4b01e59 to 3478377 Compare May 30, 2023 13:06
@rosstimothy rosstimothy enabled auto-merge May 30, 2023 13:06
@rosstimothy rosstimothy added this pull request to the merge queue May 30, 2023
Merged via the queue into master with commit 7cd49e9 May 30, 2023
@rosstimothy rosstimothy deleted the tross/login_cluster_alerts branch May 30, 2023 13:41
@public-teleport-github-review-bot
Copy link
Copy Markdown

@rosstimothy See the table below for backport results.

Branch Result
branch/v11 Create PR
branch/v12 Create PR
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants