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:
1 parent
3b873d91fe
commit
3365207c98
6 files changed
+28
-19
No files matched your search
@@ -387,7 +387,9 @@ class ProxmoxVMMixin:
|
||||
if action not in allowed:
|
||||
return {
|
||||
"success": False,
|
||||
"error": f"Action '{action}' not supported for {vm_type} (allowed: {sorted(allowed)})",
|
||||
"error": (
|
||||
f"Action '{action}' not supported for {vm_type} (allowed: {sorted(allowed)})"
|
||||
),
|
||||
}
|
||||
try:
|
||||
vm_api = self._node_api().qemu(vmid) if vm_type == "vm" else self._node_api().lxc(vmid)
|
||||
|
||||
Reference in new issue
Block a user