-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add --cluster
flag to all tsh db
subcommands, Add "--diag_addr" flag to teleport db/app start
#9220
Conversation
if clusterName == "" || clusterName == p.Cluster { | ||
return p.Databases, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this special case needed? Maybe we can just get rid of p.Databases
field completely since profile now has a method for returning databases for the specified cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found that tsh logut
is using calling dbprofile.Delete
on each of profile.Databases
I can certainly change this to use the new function. But this is a problem if we have logined db from another cluster, then we are not calling dbprofile.Delete on dbs in other clusters.
i think this is an existing problem though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added issue #9250 for tracking the dbprofile.Delete problem
I found a few places where p.Databases
are still used. Mainly when we looping through all profiles.
For example, in tsh logout, we are trying to get databases in each profile
Line 1131 in e938201
for _, db := range profile.Databases { |
Similarly, we printStatus
are all profiles and their databases (default cluster)
Line 2132 in e938201
for _, p := range profiles { |
I am debating to keep this special case for these scenarios for now. I think we can remove it once we decide what to do for the issue added above
} | ||
|
||
// addKey activates a new signed session key by adding it into the keystore. | ||
func (a *LocalKeyAgent) addKey(key *Key) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should pick a more explicative name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you test the tsh db --cluster connect
command for MySQL. It seems user my.cnf mysql profile name is generated for root cluster and needs to be aligned to work correctly.
Good catch @smallinsky! it's using profile's cluster. Let me fix and will test locally |
…/8653-8943-more-flags
…/8653-8943-more-flags
* Use t.Setenv in tests (#9154) This new feature in Go 1.17 automatically restores the environment variable to its previous value when a test ends, making it simpler to set up the environment for tests and less likely that we accidentally leave behind global state. Also convert some of the remaining uses of check to standard Go tests. * use shorter temp dir for socket path Co-authored-by: Zac Bergquist <[email protected]> Also ported a fix from #9220 to use short path for unix path in key_agent.test
…lag to `teleport db/app start` (#9220) * add diag to teleport db/app start * db --cluster flag supports * add some ut and fix issue ~/.tsh get removed during test * working mongodb * fix logout * fix ut * code review comment * fix mysql
closes #8653 #8943
Changes
--diag_addr
toteleport db/app start
--cluster
flag to alltsh db
subcommandstsh db login/ls" to show
--cluster ` in corresponding section, if cluster flag is definedcf.HomePath
should be used instead of""
, forStatusCurrent
andSaveProfile
callsTesting
Setup
Tested
tsh db
subcommands works as expected--cluster
flagtsh ssh
works as its is