Configuration only validates on final Vagrantfile proc, allowing multi-VM to work correctly
This commit is contained in:
parent
e36a9d3a0c
commit
ba9cb19808
|
@ -1,5 +1,7 @@
|
|||
## 0.6.5 (unreleased)
|
||||
|
||||
- Configuration now only validates on final Vagrantfile proc, so multi-VM
|
||||
validates correctly.
|
||||
- A nice error message is given if ".vagrant" is a directory and therefore
|
||||
can't be accessed. [GH-172]
|
||||
- Fix plugin loading in a Rails 2.3.x project. [GH-176]
|
||||
|
|
|
@ -70,9 +70,11 @@ module Vagrant
|
|||
# class.
|
||||
def execute!(config_object=nil)
|
||||
config_object ||= config
|
||||
|
||||
run_procs!(config_object)
|
||||
config_object.validate!
|
||||
|
||||
# Validate if we're looking at a config object which represents a
|
||||
# real VM.
|
||||
config_object.validate! if config_object.env.vm
|
||||
config_object
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,6 +74,7 @@ class ConfigTest < Test::Unit::TestCase
|
|||
|
||||
context "resetting" do
|
||||
setup do
|
||||
@klass.reset!(vagrant_env)
|
||||
@klass::Top.any_instance.stubs(:validate!)
|
||||
@klass.run { |config| }
|
||||
@klass.execute!
|
||||
|
@ -105,7 +106,7 @@ class ConfigTest < Test::Unit::TestCase
|
|||
|
||||
context "initializing" do
|
||||
setup do
|
||||
@klass.reset!
|
||||
@klass.reset!(vagrant_env)
|
||||
@klass::Top.any_instance.stubs(:validate!)
|
||||
end
|
||||
|
||||
|
@ -115,13 +116,21 @@ class ConfigTest < Test::Unit::TestCase
|
|||
assert_equal [proc], @klass.proc_stack
|
||||
end
|
||||
|
||||
should "run the proc stack with the config when execute is called" do
|
||||
should "run the validation on an environment which represents a VM" do
|
||||
@klass.reset!(vagrant_env.vms[:default].env)
|
||||
seq = sequence('seq')
|
||||
@klass.expects(:run_procs!).with(@klass.config).once.in_sequence(seq)
|
||||
@klass.config.expects(:validate!).once.in_sequence(seq)
|
||||
@klass.execute!
|
||||
end
|
||||
|
||||
should "not run the validation on an environment that doesn't directly represent a VM" do
|
||||
seq = sequence('seq')
|
||||
@klass.expects(:run_procs!).with(@klass.config).once.in_sequence(seq)
|
||||
@klass.expects(:validate!).never
|
||||
@klass.execute!
|
||||
end
|
||||
|
||||
should "return the configuration on execute!" do
|
||||
@klass.run {}
|
||||
result = @klass.execute!
|
||||
|
@ -129,8 +138,7 @@ class ConfigTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "use given configuration object if given" do
|
||||
fake_env = mock("env")
|
||||
config = @klass::Top.new(fake_env)
|
||||
config = @klass::Top.new(vagrant_env)
|
||||
result = @klass.execute!(config)
|
||||
assert_equal config.env, result.env
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue