BoxCollection#find should only find V1 box when searching for vbox
This commit is contained in:
parent
e2dd0b0cf2
commit
0ec639c8e1
|
@ -198,6 +198,9 @@ module Vagrant
|
||||||
return Box.new(name, provider, box_directory.dirname)
|
return Box.new(name, provider, box_directory.dirname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If we're looking for a VirtualBox box, then we check if there is
|
||||||
|
# a V1 box.
|
||||||
|
if provider == :virtualbox
|
||||||
# Check if a V1 version of this box exists, and if so, raise an
|
# Check if a V1 version of this box exists, and if so, raise an
|
||||||
# exception notifying the caller that the box exists but needs
|
# exception notifying the caller that the box exists but needs
|
||||||
# to be upgraded. We don't do the upgrade here because it can be
|
# to be upgraded. We don't do the upgrade here because it can be
|
||||||
|
@ -211,6 +214,7 @@ module Vagrant
|
||||||
@logger.warn("V1 box found: #{name}")
|
@logger.warn("V1 box found: #{name}")
|
||||||
raise Errors::BoxUpgradeRequired, :name => name
|
raise Errors::BoxUpgradeRequired, :name => name
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Didn't find it, return nil
|
# Didn't find it, return nil
|
||||||
@logger.info("Box not found: #{name} (#{provider})")
|
@logger.info("Box not found: #{name} (#{provider})")
|
||||||
|
|
|
@ -168,6 +168,14 @@ describe Vagrant::BoxCollection do
|
||||||
expect { instance.find("foo", :virtualbox) }.
|
expect { instance.find("foo", :virtualbox) }.
|
||||||
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should return nil if there is a V1 box but we're looking for another provider" do
|
||||||
|
# Create a V1 box
|
||||||
|
environment.box1("foo")
|
||||||
|
|
||||||
|
# Test
|
||||||
|
instance.find("foo", :another_provider).should be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "upgrading" do
|
describe "upgrading" do
|
||||||
|
|
Loading…
Reference in New Issue