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

Improve ssh connection debug messages #22097

Merged
merged 1 commit into from
Jul 19, 2019
Merged

Conversation

dancyatfranz
Copy link
Contributor

  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.

@hashicorp-cla
Copy link

hashicorp-cla commented Jul 16, 2019

CLA assistant check
All committers have signed the CLA.

if err != nil {
err = errors.New(fmt.Sprintf("ssh %s@%s: %s", c.connInfo.User, hostAndPort, err))
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@radeksimko radeksimko added the waiting-response An issue/pull request is waiting for a response from the community label Jul 19, 2019
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.
@radeksimko radeksimko removed the waiting-response An issue/pull request is waiting for a response from the community label Jul 19, 2019
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

👍

@radeksimko radeksimko merged commit 68d729b into hashicorp:master Jul 19, 2019
@ghost
Copy link

ghost commented Aug 19, 2019

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.

@ghost ghost locked and limited conversation to collaborators Aug 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants