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

MT-55 Catch and handle Paramiko SSH errors #48

Merged
merged 4 commits into from
Aug 23, 2023

Conversation

gandatchabana
Copy link
Contributor

Added a custom Exception class SSHConnectionError. Wraps Remote class with try except raise condition. Prints more explicit error message with possible workarounds instead of basic Exception error message which recommends to file a bug.

Ganda Tchabana and others added 2 commits July 17, 2023 16:22
Added a custom Exception class SSHConnectionError.
Wraps Remote class with try except raise condition.
Prints more explicit error message with possible workarounds instead of basic Exception error message which recommends to file a bug.
Signed-off-by: Fabrice Normandin <normandf@mila.quebec>
Copy link
Member

@breuleux breuleux left a comment

Choose a reason for hiding this comment

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

Remember to run black . and isort . to fix the formatting so the CI passes.

Comment on lines +85 to +87
if keepalive:
connection.open()
connection.transport.set_keepalive(keepalive)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure the SSHException will occur here if keepalive is not true. I think the connection object is lazy, so it may only open the connection on the first command we try to run. I don't remember if we ever set keepalive=0, so it may not matter in practice, but it's something to keep in mind.

Reformat Paramiko SSH Exception error message and made it more specific
@gandatchabana gandatchabana marked this pull request as ready for review August 18, 2023 21:53
milatools/cli/utils.py Outdated Show resolved Hide resolved
milatools/cli/remote.py Outdated Show resolved Hide resolved
Commit for code review suggestions

Co-authored-by: Olivier Breuleux <breuleux@gmail.com>
@breuleux breuleux merged commit 330d3a6 into mila-iqia:master Aug 23, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants