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

Fix database role fetch for tsh db ls --all #13617

Merged
merged 3 commits into from
Jun 17, 2022
Merged

Conversation

atburke
Copy link
Contributor

@atburke atburke commented Jun 17, 2022

This PR fixes the logic for fetching up-to-date roles in tsh db ls --all. The logic is now the same as tsh db ls.

Related: #13340 (comment)

@atburke atburke requested a review from Tener June 17, 2022 16:40
@github-actions github-actions bot added the tsh tsh - Teleport's command line tool for logging into nodes running Teleport. label Jun 17, 2022
@github-actions github-actions bot requested review from rosstimothy and xacrimon June 17, 2022 16:40
Copy link
Contributor

@rosstimothy rosstimothy left a comment

Choose a reason for hiding this comment

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

Can we extract the role set fetching into a common function that listDatabasesAllClusters and onListDatabases both call? That would help ensure that we don't deviate again in the future and would also allow others that need to do this to not fall into the same trap.

@Tener
Copy link
Contributor

Tener commented Jun 17, 2022

I think v9 is also affected, hence adding the backport-v9 label.

Copy link
Contributor

@Tener Tener left a comment

Choose a reason for hiding this comment

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

Confirmed to work now:

$ tsh db ls --all
Proxy               Cluster        Name                    Description         Allowed Users             Labels           Connect
------------------- -------------- ----------------------- ------------------- ------------------------- ---------------- ------------------------------
boson.tener.io:3080 boson.tener.io > mymongo (user: alice)                     [alice bob tener]         env=dev          tsh db connect --db-name=<n...
boson.tener.io:3080 boson.tener.io mymongo-insecure                            [alice bob tener]         env=dev
boson.tener.io:3080 boson.tener.io redisboson              Boson Redis example [alice bob tener]         env=dev
boson.tener.io:3080 quark.tener.io qmongo                                      [* alice bob quark tener] cl=quark
boson.tener.io:3080 quark.tener.io qmongo-insecure                             [* alice bob quark tener] cl=quark
boson.tener.io:3080 quark.tener.io redisquark              Quark Redis example [* alice bob quark tener] cl=quark,env=dev

Thanks for the quick fix 🥳

@atburke atburke enabled auto-merge (squash) June 17, 2022 17:33
@atburke atburke merged commit 19b2650 into master Jun 17, 2022
@github-actions
Copy link

@atburke See the table below for backport results.

Branch Result
branch/v10 Create PR
branch/v9 Create PR

@atburke atburke deleted the atburke/ls-all-db-roles branch June 17, 2022 18:28
ravicious added a commit that referenced this pull request Jun 23, 2022
#12281 fixed fetching db users for remote clusters
for `tsh db ls`. #13617 applied the same fix to
`tsh db ls --all` and extracted the `fetchRoleSet` function.

This commit extracts it to `lib/client` so that we can reuse it in
`lib/teleterm`. Other than accepting `log` as an argument, nothing was
changed about that function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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