Update drivers to support reading MAC Addresses

This commit is contained in:
Paul Morton 2012-06-07 22:18:00 -07:00 committed by Mitchell Hashimoto
parent 7bf613a162
commit 922a5aade5
3 changed files with 27 additions and 0 deletions

View File

@ -88,6 +88,7 @@ module Vagrant
:read_guest_additions_version,
:read_host_only_interfaces,
:read_mac_address,
:read_mac_addresses,
:read_machine_folder,
:read_network_interfaces,
:read_state,

View File

@ -318,6 +318,19 @@ module Vagrant
nil
end
def read_mac_addresses
macs = {}
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
info.split("\n").each do |line|
if matcher = /^macaddress(\d+)="(.+?)"$/.match(line)
adapter = matcher[1].to_i
mac = matcher[2].to_s
macs[adapter] = mac
end
end
macs
end
def read_machine_folder
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]

View File

@ -318,6 +318,19 @@ module Vagrant
nil
end
def read_mac_addresses
macs = {}
info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true)
info.split("\n").each do |line|
if matcher = /^macaddress(\d+)="(.+?)"$/.match(line)
adapter = matcher[1].to_i
mac = matcher[2].to_s
macs[adapter] = mac
end
end
macs
end
def read_machine_folder
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]