Merge remote-tracking branch 'origin/main' into feat/local-accounts
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
9ce915a8b9
3 files changed
+45
-13
No files matched your search
+13
-13
@@ -67,7 +67,7 @@ from napalm_device_types.models import (
|
||||
UpdateDict,
|
||||
UserDict,
|
||||
)
|
||||
from napalm_device_types.ssh_host_keys import HostKeyCheck
|
||||
from napalm_device_types.ssh_host_keys import HostKeyCheck, retry_refused
|
||||
from netmiko import ConnectHandler
|
||||
from netmiko.exceptions import NetmikoAuthenticationException, NetmikoTimeoutException
|
||||
|
||||
@@ -393,19 +393,19 @@ class LinuxDriver(
|
||||
"""Open the SSH connection and detect the package manager."""
|
||||
try:
|
||||
with self._host_key.netmiko(self.netmiko_optional_args) as netmiko_args_:
|
||||
self._device = ConnectHandler(
|
||||
device_type=self.NETMIKO_DEVICE_TYPE,
|
||||
host=self.hostname,
|
||||
username=self.username,
|
||||
password=self.password,
|
||||
port=self.port,
|
||||
secret=self._secret,
|
||||
timeout=self.timeout,
|
||||
**netmiko_args_,
|
||||
self._device = retry_refused( # waits out sshd's penalty (NetOrk/netork#1800)
|
||||
lambda: ConnectHandler(
|
||||
device_type=self.NETMIKO_DEVICE_TYPE,
|
||||
host=self.hostname,
|
||||
username=self.username,
|
||||
password=self.password,
|
||||
port=self.port,
|
||||
secret=self._secret,
|
||||
timeout=self.timeout,
|
||||
**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())
|
||||
|
||||
|
||||
Reference in new issue
Block a user