Class: VagrantPlugins::ProviderLibvirt::Cap::NicMacAddresses

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-libvirt/cap/nic_mac_addresses.rb

Class Method Summary collapse

Class Method Details

.nic_mac_addresses(machine) ⇒ Object


5
6
7
8
9
10
11
12
13
# File 'lib/vagrant-libvirt/cap/nic_mac_addresses.rb', line 5

def self.nic_mac_addresses(machine)
  # 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.delete(':')
  end
  nic_macs
end