fix: what bandit and the remaining lint rules found
- Long shell command lines are split into adjacent string literals. - get_os_users: a first loop over /etc/group filled a map nobody read; it is gone, the output is unchanged. - The five except Exception: pass now log at debug level (B110), so a swallowed failure leaves a trace. - nosec for the staging path on the device (B108) and the sudo hint message (B105); both are false positives. - tests: raise ... from exc, unused loop variable.
This commit is contained in:
1 parent
38391891ec
commit
933f81bd44
3 files changed
+23
-30
No files matched your search
@@ -188,7 +188,7 @@ def test_every_annotation_resolves():
|
||||
import inspect
|
||||
import typing
|
||||
|
||||
for name, member in inspect.getmembers(LinuxDriver, inspect.isfunction):
|
||||
for _name, member in inspect.getmembers(LinuxDriver, inspect.isfunction):
|
||||
if member.__module__ == "napalm_linux.linux":
|
||||
typing.get_type_hints(member)
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ def test_a_changed_key_is_refused():
|
||||
try:
|
||||
raise paramiko.BadHostKeyException("10.0.0.8", SERVER_KEY, OTHER_KEY)
|
||||
except paramiko.SSHException as exc: # what netmiko does with it
|
||||
raise NetmikoTimeoutException(f"A paramiko SSHException occurred: {exc}")
|
||||
raise NetmikoTimeoutException(f"A paramiko SSHException occurred: {exc}") from exc
|
||||
|
||||
driver = _driver(seen, SshHostKey.of(OTHER_KEY))
|
||||
with patch("napalm_linux.linux.ConnectHandler", side_effect=refuse):
|
||||
|
||||
Reference in new issue
Block a user