Update drivers to support reading MAC Addresses
This commit is contained in:
parent
7bf613a162
commit
922a5aade5
|
@ -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,
|
||||
|
|
|
@ -317,6 +317,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|
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue