From ca6c012f57838e1b4314b783bb8d57d6117973c9 Mon Sep 17 00:00:00 2001 From: Florian Mauracher Date: Tue, 29 Dec 2015 23:18:04 +0100 Subject: [PATCH] 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. --- lib/vagrant-libvirt/cap/nic_mac_addresses.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/cap/nic_mac_addresses.rb b/lib/vagrant-libvirt/cap/nic_mac_addresses.rb index f8f4c5c..c6164ae 100644 --- a/lib/vagrant-libvirt/cap/nic_mac_addresses.rb +++ b/lib/vagrant-libvirt/cap/nic_mac_addresses.rb @@ -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