mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
fix(nodedevs): the Devices page works on Python 3.12.3
The USB records named a throwaway loop variable `_`, the module's gettext.
Python 3.12.3, the Docker image's, inlines comprehensions so that this made
`_` an unbound local of the function, and the class labels' `_("Other")` in
the next comprehension raised UnboundLocalError: every Devices page failed.
Later 3.12 releases do not; the loop variables are now named.
This commit is contained in:
parent
d43245d996
commit
e28e175257
1 changed files with 3 additions and 3 deletions
|
|
@ -203,7 +203,7 @@ def _pci(name, node, nodes, children, vms):
|
|||
# of the bridge class: a host bridge or an LPC controller too
|
||||
"bridge_class": code >> 16 == 0x06,
|
||||
"resources": host_resources(name, nodes, children),
|
||||
"vms": [vm for vm, pci, _ in vms if address in pci],
|
||||
"vms": [vm for vm, pci, usb_selectors in vms if address in pci],
|
||||
"physfn": pci_address(physfn.get("domain"), physfn.get("bus"), physfn.get("slot"), physfn.get("function"))
|
||||
if physfn is not None else "",
|
||||
"vfs": len(cap.xpath("capability[@type='virt_functions']/address")),
|
||||
|
|
@ -222,7 +222,7 @@ def _usb(name, node, nodes, children, vms):
|
|||
while parent in nodes and nodes[parent].find("capability").get("type") != "pci":
|
||||
parent = nodes[parent].findtext("parent")
|
||||
controller = nodes[parent].find("capability") if parent in nodes else None
|
||||
named = [(vm, usb_named(selector, model, (bus, device))) for vm, _, selectors in vms for selector in selectors]
|
||||
named = [(vm, usb_named(selector, model, (bus, device))) for vm, pci_addresses, selectors in vms for selector in selectors]
|
||||
by_address = sorted({vm for vm, how in named if how == "address"})
|
||||
return {
|
||||
"bus": bus,
|
||||
|
|
@ -297,7 +297,7 @@ def check_hostdevs(conn, vm, trees):
|
|||
on the host of conn, when they cannot be (hostdev_problems): each
|
||||
definition on its own, as the VM starts from one of them."""
|
||||
wanted = [(tree, hostdev_users([tree])) for tree in trees]
|
||||
if not any(pci or usb for _, (pci, usb) in wanted):
|
||||
if not any(pci or usb for tree, (pci, usb) in wanted):
|
||||
return
|
||||
pci, usb = node_devices(conn)
|
||||
problems = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue