0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00

fix(vm): no IP address detection when VM contains bridges (#493)

When the VM contains at least one bridge, the main interface (e.g.
`eth0`) is left without an IP address because that's how networks
usually work.

The code that queries the VM's IP addresses (through the guest agent),
loops all available interfaces to find one. The existing code though
would prematurely exit the loop if the interface it was checking had no IP
address assigned. Like the aforementioned `eth0`, when it is controlled
by a bridge.

This patch fixes this problem by not exiting the loop, instead just continuing
to the next interface.
This commit is contained in:
mandrav 2023-08-15 04:22:50 +03:00 committed by GitHub
parent 9045183c1d
commit 9fd9d211d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,7 +445,7 @@ func (c *Client) WaitForNetworkInterfacesFromVMAgent(
if nic.IPAddresses == nil ||
(nic.IPAddresses != nil && len(*nic.IPAddresses) == 0) {
break
continue
}
for _, addr := range *nic.IPAddresses {