Don't error if box doesn't exist on load
This commit is contained in:
parent
a4713d5a84
commit
819140bbc2
|
@ -181,6 +181,10 @@ module Vagrant
|
|||
retry
|
||||
end
|
||||
|
||||
# If a box was found, then we attempt to load the Vagrantfile for
|
||||
# that box. We don't require a box since we allow providers to download
|
||||
# boxes and so on.
|
||||
if box
|
||||
box_vagrantfile = find_vagrantfile(box.directory)
|
||||
if box_vagrantfile
|
||||
# The box has a custom Vagrantfile, so we load that into the config
|
||||
|
@ -189,6 +193,7 @@ module Vagrant
|
|||
@config_loader.set(box_config_key, box_vagrantfile)
|
||||
config = @config_loader.load([:default, box_config_key, :home, :root, vm_config_key])
|
||||
end
|
||||
end
|
||||
|
||||
# Create the machine and cache it for future calls. This will also
|
||||
# return the machine from this method.
|
||||
|
|
|
@ -235,6 +235,22 @@ VF
|
|||
vm2_foo.should eql(env.machine(:vm2, :foo))
|
||||
end
|
||||
|
||||
it "should load a machine without a box" do
|
||||
register_provider("foo")
|
||||
|
||||
environment = isolated_environment do |env|
|
||||
env.vagrantfile(<<-VF)
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "i-dont-exist"
|
||||
end
|
||||
VF
|
||||
end
|
||||
|
||||
env = environment.create_vagrant_env
|
||||
machine = env.machine(:default, :foo)
|
||||
machine.box.should be_nil
|
||||
end
|
||||
|
||||
it "should load the machine configuration" do
|
||||
register_provider("foo")
|
||||
|
||||
|
|
Loading…
Reference in New Issue