-
Notifications
You must be signed in to change notification settings - Fork 8
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
Juju 7464/reuse dial logic #1529
Juju 7464/reuse dial logic #1529
Conversation
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.
lgtm with 2 comments
internal/ssh/dial.go
Outdated
} | ||
} | ||
if client == nil { | ||
return nil, fmt.Errorf("failed to dial controller ssh server: %v", errors) |
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.
this PR seems to change how we return errors.. is this an agreed direction?
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.
this is just the way to return errors in ssh dial, no change to the controller's dial
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.
well, no, it's about how we return and log errors.. i would suggest returning always returning a sensible error.. now, how the ssh server's handler treats, logs and returns these errors to its client is a different matter
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.
ah ok, i've changed it to use the errorrs pkg with the msg decoupled from the error.
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.
LGTM.. BUT.. in the underlying layers i would suggest keeping error handling (and returning) as we do in other code.. the ssh server can then log and map these error as it likes..
internal/ssh/dial.go
Outdated
} | ||
} | ||
if client == nil { | ||
return nil, fmt.Errorf("failed to dial controller ssh server: %v", errors) |
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.
well, no, it's about how we return and log errors.. i would suggest returning always returning a sensible error.. now, how the ssh server's handler treats, logs and returns these errors to its client is a different matter
36d2ee1
to
3018233
Compare
Description
In this PR we reuse some logic from the rpc dial pkg to get addresses from Controller.
First commit is just extracting the GetAddressesAndTLSConfig from the Dial method and add some tests for it.
Engineering checklist
Test instructions