fix: keep linux.py within its line count (quality ratchet)
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 56s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m3s
CI / driver (pull_request) Successful in 2m14s
driver / publish (pull_request) Skipped

One handler for the two netmiko failures that both became a
ConnectionException, and the retry's note on its own line.
This commit is contained in:
Christian Manivong committed 2026-11-01 00:33:32 +01:00
1 parent 49b7d7fef7
commit bff275402e
1 file changed
+2 -7
+2 -7
View File
@@ -391,10 +391,7 @@ class LinuxDriver(
"""Open the SSH connection and detect the package manager."""
try:
with self._host_key.netmiko(self.netmiko_optional_args) as netmiko_args_:
# Again after a pause when sshd closes the connection before its
# banner: OpenSSH 9.8+ does that to a source it has just
# penalised (NetOrk/netork#1800).
self._device = retry_refused(
self._device = retry_refused( # waits out sshd's penalty (NetOrk/netork#1800)
lambda: ConnectHandler(
device_type=self.NETMIKO_DEVICE_TYPE,
host=self.hostname,
@@ -406,9 +403,7 @@ class LinuxDriver(
**netmiko_args_,
)
)
except NetmikoAuthenticationException as exc:
raise ConnectionException(str(exc)) from exc
except NetmikoTimeoutException as exc:
except (NetmikoAuthenticationException, NetmikoTimeoutException) as exc:
raise ConnectionException(str(exc)) from exc
self._host_key.observe(self._device.remote_conn_pre.get_transport())