mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
removing try..except block
This commit is contained in:
parent
df5137a14b
commit
6bafb7264c
2 changed files with 4 additions and 11 deletions
|
@ -1149,6 +1149,7 @@ repos:
|
|||
salt/ext/.*|
|
||||
tests/.*
|
||||
)$
|
||||
additional_dependencies: ['importlib_metadata<5']
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: "1.7.4"
|
||||
hooks:
|
||||
|
@ -1158,6 +1159,7 @@ repos:
|
|||
args: [--silent, -lll, --skip, B701]
|
||||
files: ^tests/.*
|
||||
exclude: ^tests/minionswarm\.py
|
||||
additional_dependencies: ['importlib_metadata<5']
|
||||
# <---- Security ---------------------------------------------------------------------------------------------------
|
||||
|
||||
# ----- Pre-Commit ------------------------------------------------------------------------------------------------>
|
||||
|
|
|
@ -31,6 +31,7 @@ try:
|
|||
# pylint: disable=unused-import,no-name-in-module
|
||||
import napalm
|
||||
import napalm.base as napalm_base
|
||||
from napalm.base.exceptions import ConnectionClosedException
|
||||
|
||||
# pylint: enable=unused-import,no-name-in-module
|
||||
HAS_NAPALM = True
|
||||
|
@ -41,12 +42,6 @@ try:
|
|||
except ImportError:
|
||||
HAS_NAPALM = False
|
||||
|
||||
try:
|
||||
from napalm.base.exceptions import ConnectionClosedException
|
||||
|
||||
HAS_CONN_CLOSED_EXC_CLASS = True
|
||||
except ImportError:
|
||||
HAS_CONN_CLOSED_EXC_CLASS = False
|
||||
|
||||
log = logging.getLogger(__file__)
|
||||
|
||||
|
@ -179,11 +174,7 @@ def call(napalm_device, method, *args, **kwargs):
|
|||
method=method, driver=napalm_device.get("DRIVER_NAME")
|
||||
)
|
||||
)
|
||||
elif (
|
||||
retry
|
||||
and HAS_CONN_CLOSED_EXC_CLASS
|
||||
and isinstance(error, ConnectionClosedException)
|
||||
):
|
||||
elif retry and isinstance(error, ConnectionClosedException):
|
||||
# Received disconection whilst executing the operation.
|
||||
# Instructed to retry (default behaviour)
|
||||
# thus trying to re-establish the connection
|
||||
|
|
Loading…
Add table
Reference in a new issue