style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff cannot fix comes in the next commit.
This commit is contained in:
1 parent
1f6859de08
commit
3b873d91fe
27 files changed
+195
-225
No files matched your search
@@ -8,7 +8,7 @@ import ipaddress
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any, Dict, List
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from urllib.parse import quote
|
||||
|
||||
import yaml
|
||||
@@ -257,7 +257,7 @@ class ProxmoxVMProvisionMixin:
|
||||
timeout=30,
|
||||
)
|
||||
|
||||
def _nic_macs(self, vmid: int, nics: List[Dict[str, Any]]) -> list[tuple[str, bool]]:
|
||||
def _nic_macs(self, vmid: int, nics: list[dict[str, Any]]) -> list[tuple[str, bool]]:
|
||||
"""``(mac, dhcp)`` per NIC, with the MAC Proxmox assigned where none was given."""
|
||||
config = self._node_api().qemu(vmid).config.get()
|
||||
macs = []
|
||||
@@ -429,9 +429,9 @@ class ProxmoxVMProvisionMixin:
|
||||
)
|
||||
return path
|
||||
|
||||
def get_image_storages(self) -> List[StorageTargetDict]:
|
||||
def get_image_storages(self) -> list[StorageTargetDict]:
|
||||
"""List node-available storage pools suitable for a new VM's root disk."""
|
||||
targets: List[StorageTargetDict] = []
|
||||
targets: list[StorageTargetDict] = []
|
||||
for storage in self._node_api().storage.get():
|
||||
content = storage.get("content", "")
|
||||
if "images" not in content or storage.get("enabled", 1) == 0:
|
||||
@@ -538,10 +538,10 @@ class ProxmoxVMProvisionMixin:
|
||||
image_url: str,
|
||||
cpu: int,
|
||||
memory: int,
|
||||
nics: List[Dict[str, Any]],
|
||||
cloud_init_config: Dict[str, Any],
|
||||
nics: list[dict[str, Any]],
|
||||
cloud_init_config: dict[str, Any],
|
||||
image_checksum: str | None = None,
|
||||
ssh_public_keys: List[str] | None = None,
|
||||
ssh_public_keys: list[str] | None = None,
|
||||
disk_resize_gb: int | None = None,
|
||||
storage: str | None = None,
|
||||
cpu_type: str | None = None,
|
||||
@@ -633,7 +633,7 @@ class ProxmoxVMProvisionMixin:
|
||||
# Step 4: Configure network interfaces (CPU/memory already set at shell creation)
|
||||
_logger.info(f"Configuring {len(nics)} NIC(s) for VM {vmid}")
|
||||
|
||||
config_args: Dict[str, Any] = {}
|
||||
config_args: dict[str, Any] = {}
|
||||
|
||||
# Build NIC config strings generically
|
||||
for i, nic in enumerate(nics):
|
||||
@@ -941,14 +941,14 @@ class ProxmoxVMProvisionMixin:
|
||||
_logger.exception(f"Error getting status for VM {vmid}: {e}")
|
||||
raise RuntimeError(f"Failed to get VM {vmid} status: {e}")
|
||||
|
||||
def get_network_targets(self) -> List[NetworkTargetDict]:
|
||||
def get_network_targets(self) -> list[NetworkTargetDict]:
|
||||
"""
|
||||
List selectable network targets (bridges + SDN vnets) for a new VM's NIC.
|
||||
|
||||
Excludes physical NICs, bonds, and other non-bridge interface types —
|
||||
those are never valid ``NICConfigDict.bridge`` values on Proxmox.
|
||||
"""
|
||||
targets: List[NetworkTargetDict] = []
|
||||
targets: list[NetworkTargetDict] = []
|
||||
|
||||
for iface in self._get_node_network():
|
||||
iface_type = iface.get("type")
|
||||
|
||||
Reference in new issue
Block a user