Box verification uses the runner rather than the env

This commit is contained in:
Mitchell Hashimoto 2010-04-19 14:21:21 -07:00
parent d9308f86ec
commit 3e36b4ce12
3 changed files with 9 additions and 8 deletions

View File

@ -6,6 +6,7 @@ module Vagrant
# the box is assumed to be valid.
class Verify < Base
def execute!
logger.info "Verifying box..."
reload_configuration
verify_appliance
end
@ -21,7 +22,7 @@ module Vagrant
def verify_appliance
# We now try to read the applince. If it succeeds, we return true.
VirtualBox::Appliance.new(@runner.env.box.ovf_file)
VirtualBox::Appliance.new(@runner.ovf_file)
true
rescue VirtualBox::Exceptions::FileErrorException
false

View File

@ -28,19 +28,16 @@ class VerifyBoxActionTest < Test::Unit::TestCase
context "verifying appliance" do
setup do
@box = mock("box")
@box.stubs(:ovf_file).returns("foo")
@runner.env.stubs(:box).returns(@box)
@runner.stubs(:ovf_file).returns("foo")
end
should "create new appliance and return true if succeeds" do
VirtualBox::Appliance.expects(:new).with(@box.ovf_file)
VirtualBox::Appliance.expects(:new).with(@runner.ovf_file)
assert @action.verify_appliance
end
should "return false if an exception is raised" do
VirtualBox::Appliance.expects(:new).with(@box.ovf_file).raises(VirtualBox::Exceptions::FileErrorException)
VirtualBox::Appliance.expects(:new).with(@runner.ovf_file).raises(VirtualBox::Exceptions::FileErrorException)
assert !@action.verify_appliance
end
end

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Mitchell Hashimoto", "John Bender"]
s.date = %q{2010-04-15}
s.date = %q{2010-04-19}
s.default_executable = %q{vagrant}
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
@ -38,6 +38,7 @@ Gem::Specification.new do |s|
"lib/vagrant/actions/box/destroy.rb",
"lib/vagrant/actions/box/download.rb",
"lib/vagrant/actions/box/unpackage.rb",
"lib/vagrant/actions/box/verify.rb",
"lib/vagrant/actions/collection.rb",
"lib/vagrant/actions/runner.rb",
"lib/vagrant/actions/vm/boot.rb",
@ -107,6 +108,7 @@ Gem::Specification.new do |s|
"test/vagrant/actions/box/destroy_test.rb",
"test/vagrant/actions/box/download_test.rb",
"test/vagrant/actions/box/unpackage_test.rb",
"test/vagrant/actions/box/verify_test.rb",
"test/vagrant/actions/collection_test.rb",
"test/vagrant/actions/runner_test.rb",
"test/vagrant/actions/vm/boot_test.rb",
@ -176,6 +178,7 @@ Gem::Specification.new do |s|
"test/vagrant/actions/box/destroy_test.rb",
"test/vagrant/actions/box/download_test.rb",
"test/vagrant/actions/box/unpackage_test.rb",
"test/vagrant/actions/box/verify_test.rb",
"test/vagrant/actions/collection_test.rb",
"test/vagrant/actions/runner_test.rb",
"test/vagrant/actions/vm/boot_test.rb",