fix: what bandit and the remaining lint rules found

- driver.py: the logger is defined after the imports (E402). The lazy
  paramiko client is annotated Any, as _node_ssh already is; the quoted
  paramiko.SSHClient named a module that is never imported there (F821).
- Unused locals are gone: get_facts' hostname, get_users' groups (both
  read a value nobody used), the ARP flags column is _flags; the output is
  unchanged.
- Long lines are wrapped: the apt-get and snmpd.conf commands are split
  into adjacent string literals, the power-action error message and the
  system mixin's docstring are wrapped; the text is unchanged.
- get_vm_status re-raises with raise ... from e (B904).
- The two except Exception: pass (closing the SSH session, the is_alive
  probe) now log at debug level (B110), so a swallowed failure leaves a
  trace.
- nosec for the empty "password" field of NAPALM's get_users shape and
  the ssh_password_auth flag (B105); all three are false positives.
- tests: unused loop variables.
This commit is contained in:
Christian Manivong committed 2026-10-23 08:39:01 +02:00
1 parent 3b873d91fe
commit 3365207c98
6 files changed
+28 -19

No files matched your search

+1 -1
View File
@@ -939,7 +939,7 @@ class ProxmoxVMProvisionMixin:
raise
except Exception as e:
_logger.exception(f"Error getting status for VM {vmid}: {e}")
raise RuntimeError(f"Failed to get VM {vmid} status: {e}")
raise RuntimeError(f"Failed to get VM {vmid} status: {e}") from e
def get_network_targets(self) -> list[NetworkTargetDict]:
"""