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_guest_additions_version,
|
||||||
:read_host_only_interfaces,
|
:read_host_only_interfaces,
|
||||||
:read_mac_address,
|
:read_mac_address,
|
||||||
|
:read_mac_addresses,
|
||||||
:read_machine_folder,
|
:read_machine_folder,
|
||||||
:read_network_interfaces,
|
:read_network_interfaces,
|
||||||
:read_state,
|
:read_state,
|
||||||
|
|
|
@ -318,6 +318,19 @@ module Vagrant
|
||||||
nil
|
nil
|
||||||
end
|
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
|
def read_machine_folder
|
||||||
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
|
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
|
||||||
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]
|
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]
|
||||||
|
|
|
@ -318,6 +318,19 @@ module Vagrant
|
||||||
nil
|
nil
|
||||||
end
|
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
|
def read_machine_folder
|
||||||
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
|
execute("list", "systemproperties", :retryable => true).split("\n").each do |line|
|
||||||
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]
|
if folder = line[/^Default machine folder:\s+(.+?)$/i, 1]
|
||||||
|
|
Loading…
Reference in New Issue