-
Notifications
You must be signed in to change notification settings - Fork 26
Add support for SSH endpoint lookup by VM name #540
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
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: [email protected] <[email protected]>
cli/cmd/runner.go
Outdated
@@ -263,4 +263,8 @@ type runnerArgs struct { | |||
demoteChannelSequence int64 | |||
unDemoteReleaseSequence int64 | |||
unDemoteChannelSequence int64 | |||
|
|||
sshVMID string |
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.
remove these 3 unused vars (they are unused, right?)
Co-Authored-By: [email protected] <[email protected]>
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.
Seems to work well as well in my testing.
My only issue with this is that it lists and therefore completes VMs that are not yet in running state which may result in an issue when the user tries to use that specific VM but perhaps the UX around not completing something a user would expect to get completed is more annoying then only completing "running"
state VMs.
We should either only return running VMs to the completion OR provide a useful error back to the user that the vm is not yet in running state.
The error we get now if we do try to ssh to a VM that isn't yet "running"
is:
./bin/replicated vm ssh-endpoint intelligent_varahamihira
Error: VM 4ef40195 does not have SSH endpoint configured
which might be confusing to a user.
…ter error messages Co-Authored-By: [email protected] <[email protected]>
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.
Since we're already here and the change was made to only filter running VMs let's update the Long
help text to specify that ssh endpoints can only be retrieved from running VMs.
what happens if there's multiple vms with the same name? it's possible today to have multiple vms with the same name but different ids |
Co-Authored-By: [email protected] <[email protected]>
On that new error message it would be nice to also add something like "To view all VM IDs run |
if _, err := r.kotsAPI.GetVM(arg); err == nil { | ||
return arg, 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.
getVMIDFromArg function will mask valid errors from the user. If GetVM returns ErrNotFound or ErrForbidden, then we can call ListVMs. Otherwise this function should fail. ErrForbidden can be returned due to RBAC rules.
… for specific errors Co-Authored-By: [email protected] <[email protected]>
Add support for SSH endpoint lookup by VM name
This PR adds the ability to get the SSH endpoint of a VM by name in addition to the existing functionality of getting it by VM ID.
Changes
vm ssh-endpoint
command to accept either VM ID or VM nameTesting
make build
go fmt ./...
make test-unit && make test-integration
Link to Devin run: https://app.devin.ai/sessions/cfe3ddd734084631a3ae23a8d2a48178
Requested by: [email protected]