Replace bare exception handlers in whaletag SSH functions#43
Open
InterstellarIntruder wants to merge 1 commit into
Open
Replace bare exception handlers in whaletag SSH functions#43InterstellarIntruder wants to merge 1 commit into
InterstellarIntruder wants to merge 1 commit into
Conversation
c6c482f to
f6c715b
Compare
get_hostname_by_addr() and can_connect() were catching all exceptions silently, making it impossible to debug connection failures in the field. Now catches paramiko.SSHException, AuthenticationException, and OSError specifically, and logs the error with the target address. Adds 9 unit tests covering success, auth failure, SSH errors, network errors, and KeyboardInterrupt propagation. Fixes Project-CETI#39
f6c715b to
a6161ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #39
get_hostname_by_addr()andcan_connect()were catching all exceptions silently -- wrong password, network timeout, SSH server down all returned False with no error message. This made it impossible to debug connection failures in the field.Changes:
paramiko.AuthenticationException,paramiko.SSHException, andOSErrorinstead of bareexcept:/except BaseException:KeyboardInterruptandSystemExitare no longer swallowedTests:
9 new unit tests in
tests/test_whaletag.pycovering success paths, each failure type, and KeyboardInterrupt propagation.