Skip to content

fix: handle nil network name for bridge/direct interfaces#189

Open
ajmeese7 wants to merge 1 commit into
fog:masterfrom
ajmeese7:fix/nil-network-name-bridge-interfaces
Open

fix: handle nil network name for bridge/direct interfaces#189
ajmeese7 wants to merge 1 commit into
fog:masterfrom
ajmeese7:fix/nil-network-name-bridge-interfaces

Conversation

@ajmeese7
Copy link
Copy Markdown

When a VM has a bridge or macvtap interface (e.g. from a Vagrant public_network with :dev), libvirt represents it without a source network attribute. fog-libvirt's addresses() passes nic.network (nil) to list_networks, which calls lookup_network_by_name(nil), raising:

TypeError: no implicit conversion of nil into String

Fix by returning nil early in get_network_by_filter when the name filter is nil, and compacting the result in list_networks so that Fog::Collection#load never receives a nil entry.

Fixes vagrant-libvirt state checks crashing on VMs with bridge NICs.

When a VM has a bridge or macvtap interface (e.g. from a Vagrant
public_network with :dev), libvirt represents it without a source
network attribute. fog-libvirt's addresses() passes nic.network (nil)
to list_networks, which calls lookup_network_by_name(nil), raising:

  TypeError: no implicit conversion of nil into String

Fix by returning nil early in get_network_by_filter when the name
filter is nil, and compacting the result in list_networks so that
Fog::Collection#load never receives a nil entry.

Fixes vagrant-libvirt state checks crashing on VMs with bridge NICs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant