Merged
Conversation
added 4 commits
May 28, 2021 20:10
Signed-off-by: Andrew Mason <amason@slack-corp.com>
This turns the output from: ``` ❯ vtctlclient -server "localhost:15999" ListAllTablets -h Usage: ListAllTablets <cell name1>, <cell name2>, ... Lists all tablets in an awk-friendly way. ListAllTablets Error: rpc error: code = Unknown desc = flag: help requested E0528 19:52:46.564223 77260 main.go:76] remote error: rpc error: code = Unknown desc = flag: help requested ❯ echo $? 1 ``` into: ``` ❯ vtctlclient -server "localhost:15999" ListAllTablets -h Usage: ListAllTablets <cell name1>, <cell name2>, ... Lists all tablets in an awk-friendly way. ❯ echo $? 0 ``` Signed-off-by: Andrew Mason <amason@slack-corp.com>
This is admittedly pretty hacky, and I had to spend a lot of time messing around with cobra to make this behavior correctly. But, it works! Signed-off-by: Andrew Mason <amason@slack-corp.com>
Also remove the custom help func hack, because it turns out we don't actually need it (thank goodness) Signed-off-by: Andrew Mason <amason@slack-corp.com>
ajm188
commented
Jun 8, 2021
| logutil.LogEvent(logger, e) | ||
| }) | ||
| if err != nil { | ||
| if strings.Contains(err.Error(), "flag: help requested") { |
Contributor
Author
There was a problem hiding this comment.
This turns:
❯ vtctlclient -server "localhost:15999" ListAllTablets -h
Usage: ListAllTablets <cell name1>, <cell name2>, ...
Lists all tablets in an awk-friendly way.
ListAllTablets Error: rpc error: code = Unknown desc = flag: help requested
E0528 19:52:46.564223 77260 main.go:76] remote error: rpc error: code = Unknown desc = flag: help requested
❯ echo $?
1
Into
❯ vtctlclient -server "localhost:15999" ListAllTablets -h
Usage: ListAllTablets <cell name1>, <cell name2>, ...
Lists all tablets in an awk-friendly way.
❯ echo $?
0
doeg
approved these changes
Jun 9, 2021
| @@ -0,0 +1,23 @@ | |||
| /* | |||
| Copyright 2020 The Vitess Authors. | |||
Contributor
There was a problem hiding this comment.
Tiny nit: copyright is the wrong year
Contributor
Author
There was a problem hiding this comment.
ahah i copied this file from vtctlclient
|
|
||
| package main | ||
|
|
||
| // Imports and register the gRPC vtctl client. |
Contributor
There was a problem hiding this comment.
Another tiny nit: "register" -> "registers"
Signed-off-by: Andrew Mason <amason@slack-corp.com>
ajm188
pushed a commit
to tinyspeck/vitess
that referenced
this pull request
Jul 23, 2021
…y_shim [vtctldclient] Add legacy shim
8 tasks
33 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a shim to the new vtctldclient to allow running legacy vtctl commands that have not yet been migrated. The intention here is to allow users to start updating any scripts they have now (going from
vtctlclient [args ...]tovtctldclient LegacyVtctlCommand -- [args ...]), and then dropping the old client should be ideally a no-op, or at least far less painful.Examples!
client-side help
server-side help showing available commands
Getting tablets, both ways
Getting per-command server-side help, using legacy commands that take flags, etc
Related Issue(s)
#7058
Checklist
Deployment Notes