virtualbox: handle a list of bridged nics
This change allows you to specify multiple network interfaces to bridge to, picking the first found. ```ruby config.vm.network "public_network", bridge: ["en4: Thunderbolt Ethernet", "en6: Broadcom NetXtreme Gigabit Ethernet Controller", "en0: Wi-Fi (AirPort)"] ```
This commit is contained in:
parent
1cf2a8db4c
commit
2b3411965a
|
@ -157,14 +157,18 @@ module VagrantPlugins
|
|||
@logger.debug("Bridge was directly specified in config, searching for: #{config[:bridge]}")
|
||||
|
||||
# Search for a matching bridged interface
|
||||
bridge = config[:bridge]
|
||||
bridge = bridge.downcase if bridge.respond_to?(:downcase)
|
||||
bridgedifs.each do |interface|
|
||||
if bridge === interface[:name].downcase
|
||||
@logger.debug("Specific bridge found as configured in the Vagrantfile. Using it.")
|
||||
chosen_bridge = interface[:name]
|
||||
break
|
||||
bridges = config[:bridge]
|
||||
bridges = [bridges] if not bridges.respond_to?(:each)
|
||||
bridges.each do |bridge|
|
||||
bridge = bridge.downcase if bridge.respond_to?(:downcase)
|
||||
bridgedifs.each do |interface|
|
||||
if bridge === interface[:name].downcase
|
||||
@logger.debug("Specific bridge found as configured in the Vagrantfile. Using it.")
|
||||
chosen_bridge = interface[:name]
|
||||
break
|
||||
end
|
||||
end
|
||||
break if chosen_bridge
|
||||
end
|
||||
|
||||
# If one wasn't found, then we notify the user here.
|
||||
|
|
Loading…
Reference in New Issue