providers/virtualbox: don't error when intnet set to "true" [GH-2751]

This commit is contained in:
Mitchell Hashimoto 2014-01-03 08:29:33 -08:00
parent e665e9ee8f
commit 2f7163386d
4 changed files with 34 additions and 1 deletions

View File

@ -362,12 +362,15 @@ module VagrantPlugins
end
def intnet_adapter(config)
intnet_name = config[:intnet]
intnet_name = "intnet" if intnet_name == true
return {
:adapter => config[:adapter],
:type => :intnet,
:mac_address => config[:mac],
:nic_type => config[:nic_type],
:intnet => config[:intnet]
:intnet => intnet_name,
}
end

View File

@ -0,0 +1,21 @@
shared_examples "provider/network/intnet" do |provider, options|
if !options[:box]
raise ArgumentError,
"box option must be specified for provider: #{provider}"
end
include_context "acceptance"
before do
environment.skeleton("network_intnet")
assert_execute("vagrant", "box", "add", "box", options[:box])
assert_execute("vagrant", "up", "--provider=#{provider}")
end
after do
assert_execute("vagrant", "destroy", "--force", log: false)
end
it "properly configures an internal network" do
end
end

View File

@ -0,0 +1,6 @@
Vagrant.configure("2") do |config|
config.vm.box = "box"
config.vm.network "private_network",
ip: "192.168.50.4",
virtualbox__intnet: true
end

View File

@ -1,6 +1,9 @@
require_relative "test/acceptance/base"
Vagrant::Spec::Acceptance.configure do |c|
c.component_paths << File.expand_path("../test/acceptance", __FILE__)
c.skeleton_paths << File.expand_path("../test/acceptance/skeletons", __FILE__)
c.provider "virtualbox",
box: "<PATH TO MINIMAL BOX>",
contexts: ["provider-context/virtualbox"]