netmiko poxy import fixes (#62404)

* need to check the version of Netmiko python library and then import the exceptions from different locations depending on the result.

* Adding changelog.

* swap out if...else for double try...except.
This commit is contained in:
Gareth J. Greenaway 2022-08-08 08:20:41 -07:00 committed by GitHub
parent b8dfef5076
commit d6307c2a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

1
changelog/62405.fixed Normal file
View file

@ -0,0 +1 @@
Due to changes in the Netmiko library for the exception paths, need to check the version of Netmiko python library and then import the exceptions from different locations depending on the result.

View file

@ -190,10 +190,14 @@ import salt.utils.args
try:
from netmiko import ConnectHandler
from netmiko.ssh_exception import (
NetMikoAuthenticationException,
NetMikoTimeoutException,
)
try:
from netmiko import NetMikoAuthenticationException, NetMikoTimeoutException
except ImportError:
from netmiko.ssh_exception import (
NetMikoAuthenticationException,
NetMikoTimeoutException,
)
HAS_NETMIKO = True
except ImportError: