Skip to content

Commit

Permalink
driver: Use MAC of the first "shared" adapter
Browse files Browse the repository at this point in the history
In some custom cases shared adapter can have an index different from "0"
#185
  • Loading branch information
legal90 committed Jun 5, 2015
1 parent d8a3c50 commit 0b797fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/vagrant-parallels/driver/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def read_guest_tools_iso_path(guest_os)
def read_host_only_interfaces
end

# Returns the MAC address of the first network interface.
# Returns the MAC address of the first Shared network interface.
#
# @return [String]
def read_mac_address
Expand Down
8 changes: 6 additions & 2 deletions lib/vagrant-parallels/driver/pd_8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,12 @@ def read_host_only_interfaces
end

def read_mac_address
# Get MAC of Shared network interface (net0)
read_vm_option('mac').strip.split(' ').first.gsub(':', '')
hw_info = read_settings.fetch('Hardware', {})
shared_ifaces = hw_info.select do |name, params|
name.start_with?('net') && params['type'] == 'shared'
end

shared_ifaces.values.first.fetch('mac', nil)
end

def read_mac_addresses
Expand Down

0 comments on commit 0b797fa

Please # to comment.