Fix network interface configuration for windows guests

Change the return format of the nic_mac_addresses capability to comply
with the format expected by Vagrant:
    # Vagrant expects a hash with an index starting at 1 as key
    # and the mac as uppercase string without colons as value

This fixes the configuration of additional network interfaces for
Windows guests. Other guests don't require the mac address of a
interface to configure it, thus this only affected windows guests.
This commit is contained in:
Florian Mauracher 2015-12-29 23:18:04 +01:00
parent bc81274f6e
commit ca6c012f57

View File

@ -3,7 +3,13 @@ module VagrantPlugins
module Cap
class NicMacAddresses
def self.nic_mac_addresses(machine)
machine.provider.mac_addresses
# Vagrant expects a Hash with an index starting at 1 as key
# and the mac as uppercase string without colons as value
nic_macs = {}
machine.provider.mac_addresses.each do |index, mac|
nic_macs[index+1] = mac.upcase.gsub(':','')
end
nic_macs
end
end
end