mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Adjust vbox hostonly config for ipv6
Check the type when an ipv6 address is being used. If the type does not have a `6` suffix, append it.
This commit is contained in:
parent
f4142705ab
commit
6db640fb14
2 changed files with 25 additions and 0 deletions
|
|
@ -302,6 +302,9 @@ module VagrantPlugins
|
|||
elsif ip.ipv6?
|
||||
options[:netmask] ||= 64
|
||||
|
||||
# Append a 6 to the end of the type if it is not already set
|
||||
options[:type] = "#{options[:type]}6".to_sym if
|
||||
!options[:type].to_s.end_with?("6")
|
||||
else
|
||||
raise IPAddr::AddressFamilyError, 'unknown address family'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,6 +62,28 @@ describe VagrantPlugins::ProviderVirtualBox::Action::Network do
|
|||
expect(subject).to receive(:validate_hostonly_ip!)
|
||||
subject.hostonly_config(options)
|
||||
end
|
||||
|
||||
context "when address is ipv6" do
|
||||
let(:address) { "::1" }
|
||||
|
||||
context "when type is static6" do
|
||||
let(:type) { :static6 }
|
||||
|
||||
it "should have a static6 type" do
|
||||
result = subject.hostonly_config(options)
|
||||
expect(result[:type]).to eq(:static6)
|
||||
end
|
||||
end
|
||||
|
||||
context "when type is static" do
|
||||
let(:type) { :static }
|
||||
|
||||
it "should have static6 type" do
|
||||
result = subject.hostonly_config(options)
|
||||
expect(result[:type]).to eq(:static6)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#validate_hostonly_ip!" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue