Merge pull request #7491 from mitchellh/sethvargo/osx_guest
guests/darwin: Allow ipv6 static networks
This commit is contained in:
commit
d93a2d6afc
|
@ -448,6 +448,10 @@ module Vagrant
|
||||||
error_key(:not_found, "vagrant.actions.vm.host_only_network")
|
error_key(:not_found, "vagrant.actions.vm.host_only_network")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class NetworkTypeNotSupported < VagrantError
|
||||||
|
error_key(:network_type_not_supported)
|
||||||
|
end
|
||||||
|
|
||||||
class NFSBadExports < VagrantError
|
class NFSBadExports < VagrantError
|
||||||
error_key(:nfs_bad_exports)
|
error_key(:nfs_bad_exports)
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,12 +35,19 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
network_type = network[:type].to_sym
|
network_type = network[:type].to_sym
|
||||||
if network_type == :static
|
case network_type.to_sym
|
||||||
command = "networksetup -setmanual \"#{service_name}\" #{network[:ip]} #{network[:netmask]}"
|
when :static
|
||||||
elsif network_type == :dhcp
|
command = "networksetup -setmanual \"#{service_name}\" #{network[:ip]} #{network[:netmask]} #{network[:router]}"
|
||||||
|
when :static6
|
||||||
|
command = "networksetup -setv6manual \"#{service_name}\" #{network[:ip]} #{network[:netmask]} #{network[:router]}"
|
||||||
|
when :dhcp
|
||||||
command = "networksetup -setdhcp \"#{service_name}\""
|
command = "networksetup -setdhcp \"#{service_name}\""
|
||||||
|
when :dhcp6
|
||||||
|
# This is not actually possible yet in Vagrant, but when we do
|
||||||
|
# enable IPv6 across the board, Darwin will already have support.
|
||||||
|
command = "networksetup -setv6automatic \"#{service_name}\""
|
||||||
else
|
else
|
||||||
raise "#{network_type} network type is not supported, try static or dhcp"
|
raise Vagrant::Errors::NetworkTypeNotSupported, type: network_type
|
||||||
end
|
end
|
||||||
|
|
||||||
machine.communicate.sudo(command)
|
machine.communicate.sudo(command)
|
||||||
|
@ -65,7 +72,7 @@ module VagrantPlugins
|
||||||
ints = ::IO.read(tmp_ints)
|
ints = ::IO.read(tmp_ints)
|
||||||
ints.split(/\n\n/m).each do |i|
|
ints.split(/\n\n/m).each do |i|
|
||||||
if i.match(/Hardware/) && i.match(/Ethernet/)
|
if i.match(/Hardware/) && i.match(/Ethernet/)
|
||||||
# Ethernet, should be 2 lines,
|
# Ethernet, should be 2 lines,
|
||||||
# (3) Thunderbolt Ethernet
|
# (3) Thunderbolt Ethernet
|
||||||
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
||||||
|
|
||||||
|
|
|
@ -869,6 +869,8 @@ en:
|
||||||
If the problem persists, please report a bug to the net-ssh project.
|
If the problem persists, please report a bug to the net-ssh project.
|
||||||
|
|
||||||
%{message}
|
%{message}
|
||||||
|
network_type_not_supported: |-
|
||||||
|
The %{type} network type is not supported for this box or guest.
|
||||||
nfs_bad_exports: |-
|
nfs_bad_exports: |-
|
||||||
NFS is reporting that your exports file is invalid. Vagrant does
|
NFS is reporting that your exports file is invalid. Vagrant does
|
||||||
this check before making any changes to the file. Please correct
|
this check before making any changes to the file. Please correct
|
||||||
|
|
Loading…
Reference in New Issue