fix: what bandit and the remaining lint rules found

- Netgear Plus: a failed logout on close() now logs at debug level (B110),
  so a swallowed failure leaves a trace; the module gets its logger.
- nosec for the firmware CDN probe (B310): the URL is built on the fixed
  https base _FW_CDN_BASE, model and version only fill its path, so no
  file:// or custom scheme can reach urlopen.
- nosec for the empty password in get_users (B105): it is NAPALM's field,
  the CLI never shows a password; a false positive.
- The v7 LLDP table in a docstring loses one leading space per line to fit
  line length 100.
- tests: a second TestGetLldpNeighbors class shadowed the first, whose two
  tests never ran; the v7 one is now TestGetLldpNeighborsV7 and both run
  (and pass). raise ... from exc in the netmiko stand-in.
This commit is contained in:
Christian Manivong committed 2026-10-23 08:34:17 +02:00
1 parent fa10d6617b
commit 672bc04261
4 files changed
+13 -8

No files matched your search

+5 -4
View File
@@ -1115,9 +1115,9 @@ class NetgearSmartDriver(ConfigLifecycleMixin, SnmpAgentMixin, SwitchDriver):
``show lldp`` — both answer "Unknown command". Only the singular
``neighbor`` works, and it lays the table out differently::
Port | Device ID | Port ID | SysName | Capabilities | TTL
---- + ----------------- + ---------------- + ----------------- + -------------- + -----
g9 | 10:01:02:44:37:26 |10:01:02:44:37:28 | pve-eze.eze.local | Bridge | 97
Port | Device ID | Port ID | SysName | Capabilities | TTL
---- + ----------------- + ---------------- + ----------------- + -------------- + -----
g9 | 10:01:02:44:37:26 |10:01:02:44:37:28 | pve-eze.eze.local | Bridge | 97
Ports are named ``g9`` rather than ``0/1``, and the columns are
separated by ``|`` with irregular padding — splitting on whitespace
@@ -1629,7 +1629,8 @@ class NetgearSmartDriver(ConfigLifecycleMixin, SnmpAgentMixin, SwitchDriver):
username = parts[0]
role = parts[1].lower()
level = 15 if "write" in role or "admin" in role else 1
users[username] = {"level": level, "password": "", "sshkeys": []}
# NAPALM's get_users shape: the CLI never shows a password, so it is empty.
users[username] = {"level": level, "password": "", "sshkeys": []} # nosec B105
return users