fix: what bandit and the remaining lint rules found

- Long lines are wrapped: the get_environment awk command is split into
  adjacent string literals, the rollback message and the system mixin's
  docstring are wrapped; the command and the text are unchanged.
- The two except Exception: pass (the snmpd community in get_snmp_config,
  the network VLANs in get_ssids) now log at debug level (B110), so a
  swallowed failure leaves a trace.
- tests: raise ... from exc, unused loop variable.
This commit is contained in:
Christian Manivong committed 2026-10-23 08:33:29 +02:00
1 parent a212bc8715
commit 8b8905f0c7
5 files changed
+19 -7

No files matched your search

+1 -1
View File
@@ -911,7 +911,7 @@ class TestGetRouteTo:
def test_required_keys(self, driver):
driver._send_command = lambda cmd, **kw: IP_ROUTE_SHOW
for prefix, routes in driver.get_route_to().items():
for _prefix, routes in driver.get_route_to().items():
for route in routes:
assert set(route.keys()) >= {
"protocol",
+1 -1
View File
@@ -76,7 +76,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(HANDLER, side_effect=refuse):