Validate only certain command sequences [closes GH-188]
This commit is contained in:
parent
92c37f7435
commit
39407694e3
|
@ -1,5 +1,6 @@
|
|||
## 0.6.6 (unreleased)
|
||||
|
||||
- Conditional validation of Vagrantfile so that some commands don't validate. [GH-188]
|
||||
- Fix "junk" output for ssh-config. [GH-189]
|
||||
- Fix port collision handling with greater than two VMs. [GH-185]
|
||||
- Fix potential infinite loop with root path if bad CWD is given to environment.
|
||||
|
|
|
@ -100,7 +100,7 @@ module Vagrant
|
|||
action_environment.merge!(options || {})
|
||||
|
||||
# Run the before action run callback, if we're not doing that already
|
||||
run(:before_action_run) if callable_id != :before_action_run
|
||||
run(:before_action_run, action_environment) if callable_id != :before_action_run
|
||||
|
||||
# Run the action chain in a busy block, marking the environment as
|
||||
# interrupted if a SIGINT occurs, and exiting cleanly once the
|
||||
|
|
|
@ -58,17 +58,17 @@ module Vagrant
|
|||
# is kicked out to the `box_add` registered middleware.
|
||||
def add
|
||||
raise Errors::BoxAlreadyExists.new(:name => name) if File.directory?(directory)
|
||||
env.actions.run(:box_add, { "box" => self })
|
||||
env.actions.run(:box_add, { "box" => self, "validate" => false })
|
||||
end
|
||||
|
||||
# Begins the process of destroying this box. This cannot be undone!
|
||||
def destroy
|
||||
env.actions.run(:box_remove, { "box" => self })
|
||||
env.actions.run(:box_remove, { "box" => self, "validate" => false })
|
||||
end
|
||||
|
||||
# Begins sequence to repackage this box.
|
||||
def repackage(options=nil)
|
||||
env.actions.run(:box_repackage, { "box" => self }.merge(options || {}))
|
||||
env.actions.run(:box_repackage, { "box" => self, "validate" => false }.merge(options || {}))
|
||||
end
|
||||
|
||||
# Returns the directory to the location of this boxes content in the local
|
||||
|
|
|
@ -108,7 +108,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def package(options=nil)
|
||||
env.actions.run(:package, options)
|
||||
env.actions.run(:package, { "validate" => false }.merge(options || {}))
|
||||
end
|
||||
|
||||
def up(options=nil)
|
||||
|
|
|
@ -36,7 +36,7 @@ class BoxTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "execute the Add action when add is called" do
|
||||
@box.env.actions.expects(:run).with(:box_add, { "box" => @box })
|
||||
@box.env.actions.expects(:run).with(:box_add, { "box" => @box, "validate" => false })
|
||||
@box.add
|
||||
end
|
||||
|
||||
|
@ -48,19 +48,19 @@ class BoxTest < Test::Unit::TestCase
|
|||
|
||||
context "destroying" do
|
||||
should "execute the destroy action" do
|
||||
@box.env.actions.expects(:run).with(:box_remove, { "box" => @box })
|
||||
@box.env.actions.expects(:run).with(:box_remove, { "box" => @box, "validate" => false })
|
||||
@box.destroy
|
||||
end
|
||||
end
|
||||
|
||||
context "repackaging" do
|
||||
should "execute the repackage action" do
|
||||
@box.env.actions.expects(:run).with(:box_repackage, { "box" => @box })
|
||||
@box.env.actions.expects(:run).with(:box_repackage, { "box" => @box, "validate" => false })
|
||||
@box.repackage
|
||||
end
|
||||
|
||||
should "forward given options into the action" do
|
||||
@box.env.actions.expects(:run).with(:box_repackage, { "box" => @box, "foo" => "bar" })
|
||||
@box.env.actions.expects(:run).with(:box_repackage, { "box" => @box, "foo" => "bar", "validate" => false })
|
||||
@box.repackage("foo" => "bar")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -358,7 +358,6 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
call_seq = sequence("call_sequence")
|
||||
@klass.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
||||
env.expects(:load_config!).once.in_sequence(call_seq)
|
||||
env.actions.expects(:run).with(:environment_load).once.in_sequence(call_seq)
|
||||
assert_equal env, env.load!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -165,7 +165,12 @@ class VMTest < Test::Unit::TestCase
|
|||
|
||||
context "packaging" do
|
||||
should "execute the package action" do
|
||||
@vm.env.actions.expects(:run).with(:package, :foo => :bar).once
|
||||
@vm.env.actions.expects(:run).once.with() do |action, options|
|
||||
assert_equal :package, action
|
||||
assert_equal :bar, options[:foo]
|
||||
true
|
||||
end
|
||||
|
||||
@vm.package(:foo => :bar)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue