-
Notifications
You must be signed in to change notification settings - Fork 15
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
Timeout is fake? #60
Comments
It is not fake but is left to be considered by the underlying task (SSHOpen) in your example, which seems to not be honoring it. Feel free to submit a PR fixing the issue. |
OK, I will consider how to solve this problem and submit a PR fixing the issue. |
Thanks for your reply! |
Looks like https://github.com/nornir-automation/gornir/blob/master/pkg/plugins/connection/ssh.go#L72-L77 client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", host.Hostname, port), config)
if err != nil {
return &SSH{}, errors.Wrap(err, "failed to dial")
}
host.SetConnection("ssh", &SSH{client})
return &SSH{client}, nil Maybe a solution is what they describe here: golang/go#20288 (comment). In a nutshell, create a new func Dial(ctx context.Context, network, addr string, config *ssh.ClientConfig) (*ssh.Client, error) {
d := net.Dialer{Timeout: config.Timeout}
conn, err := d.DialContext(ctx, network, addr)
if err != nil {
return nil, err
}
c, chans, reqs, err := ssh.NewClientConn(conn, addr, config)
if err != nil {
return nil, err
}
return ssh.NewClient(c, chans, reqs), nil
} |
Even if I add use the context.WithTimeout, but it does not effective
The text was updated successfully, but these errors were encountered: