fix: resolve the node the connection landed on, not the first cluster member
_resolve_node() took the first entry of GET /nodes. In a cluster that lists every member, so a node polled without an explicit `node` driver argument talked to whichever member came first: pve-dual reported pve-02's name and VMs, and netOrk's VM sync moved pve-02's VM devices over to it. Resolve through GET /cluster/status instead: the entry marked local, then a match by IP or (short) name, then the sole node of a standalone host, and otherwise raise rather than guess. The lookup no longer swallows API errors either. A TLS verification failure used to leave the IP as the node name, so open() succeeded and every getter failed quietly while the poll reported success with empty data. It now surfaces as a ConnectionException from open(). Refs NetOrk/netork#417, NetOrk/netork#418
This commit is contained in:
@@ -138,6 +138,7 @@ def _build_mock_api(
|
||||
pve_users=None,
|
||||
exec_return="",
|
||||
sensors=None,
|
||||
cluster_status=None,
|
||||
):
|
||||
"""Build a MagicMock ProxmoxAPI with pre-configured return values."""
|
||||
api = MagicMock()
|
||||
@@ -165,6 +166,7 @@ def _build_mock_api(
|
||||
# SDN
|
||||
cluster = MagicMock()
|
||||
api.cluster = cluster
|
||||
cluster.status.get.return_value = cluster_status or []
|
||||
cluster.sdn.zones.get.return_value = sdn_zones or SDN_ZONES
|
||||
cluster.sdn.vnets.get.return_value = sdn_vnets or SDN_VNETS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user