guests/darwin: Allow ipv6 static networks
This commit is contained in:
parent
22c24d619c
commit
177b7784dd
|
@ -448,6 +448,10 @@ module Vagrant
|
|||
error_key(:not_found, "vagrant.actions.vm.host_only_network")
|
||||
end
|
||||
|
||||
class NetworkTypeNotSupported < VagrantError
|
||||
error_key(:network_type_not_supported)
|
||||
end
|
||||
|
||||
class NFSBadExports < VagrantError
|
||||
error_key(:nfs_bad_exports)
|
||||
end
|
||||
|
|
|
@ -35,12 +35,19 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
network_type = network[:type].to_sym
|
||||
if network_type == :static
|
||||
command = "networksetup -setmanual \"#{service_name}\" #{network[:ip]} #{network[:netmask]}"
|
||||
elsif network_type == :dhcp
|
||||
case network_type.to_sym
|
||||
when :static
|
||||
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}\""
|
||||
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
|
||||
raise "#{network_type} network type is not supported, try static or dhcp"
|
||||
raise Vagrant::Errors::NetworkTypeNotSupported, type: network_type
|
||||
end
|
||||
|
||||
machine.communicate.sudo(command)
|
||||
|
@ -65,7 +72,7 @@ module VagrantPlugins
|
|||
ints = ::IO.read(tmp_ints)
|
||||
ints.split(/\n\n/m).each do |i|
|
||||
if i.match(/Hardware/) && i.match(/Ethernet/)
|
||||
# Ethernet, should be 2 lines,
|
||||
# Ethernet, should be 2 lines,
|
||||
# (3) Thunderbolt Ethernet
|
||||
# (Hardware Port: Thunderbolt Ethernet, Device: en1)
|
||||
|
||||
|
|
|
@ -869,6 +869,8 @@ en:
|
|||
If the problem persists, please report a bug to the net-ssh project.
|
||||
|
||||
%{message}
|
||||
network_type_not_supported: |-
|
||||
The %{type} network type is not supported for this box or guest.
|
||||
nfs_bad_exports: |-
|
||||
NFS is reporting that your exports file is invalid. Vagrant does
|
||||
this check before making any changes to the file. Please correct
|
||||
|
|
Loading…
Reference in New Issue