-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Improve ssh connection debug messages #22097
Conversation
communicator/ssh/communicator.go
Outdated
if err != nil { | ||
err = errors.New(fmt.Sprintf("ssh %s@%s: %s", c.connInfo.User, hostAndPort, err)) |
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.
Thank you for improving all the debug messages - these look 👍 to me.
How do you feel about using https://github.com/hashicorp/errwrap for wrapping the error here, so we're not just turning the error into a string, but retaining all useful details?
e.g.
errwrap.Wrapf(fmt.Sprintf("Failed to establish SSH connection (%s@%s): {{err}}", c.connInfo.User, hostAndPort), err)
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 was wondering if there was a better way. I'll make that change.
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.
Done
1) Mention the host and port in the "Connecting..." message. 2) Mention the username in the post-connection handshaking message. 3) If handshaking fails, mention the user, host, and port in the error message that will eventually be returned to the user.
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'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Mention the host and port in the "Connecting..." message.
Mention the username in the post-connection handshaking message.
If handshaking fails, mention the user, host, and port in the error
message that will eventually be returned to the user.