BoxCollection#add throws an UpgradeRequired exception if a V1 box
already exists
This commit is contained in:
parent
1d197d84c3
commit
798ffc93bd
|
@ -60,6 +60,10 @@ module Vagrant
|
||||||
# to unpack any files.
|
# to unpack any files.
|
||||||
check_box_exists.call(provider) if provider
|
check_box_exists.call(provider) if provider
|
||||||
|
|
||||||
|
# Verify that a V1 box doesn't exist. If it does, then we signal
|
||||||
|
# to the user that we need an upgrade.
|
||||||
|
raise Errors::BoxUpgradeRequired, :name => name if v1_box?(@directory.join(name))
|
||||||
|
|
||||||
# Create a temporary directory since we're not sure at this point if
|
# Create a temporary directory since we're not sure at this point if
|
||||||
# the box we're unpackaging already exists (if no provider was given)
|
# the box we're unpackaging already exists (if no provider was given)
|
||||||
Dir.mktmpdir("vagrant-") do |temp_dir|
|
Dir.mktmpdir("vagrant-") do |temp_dir|
|
||||||
|
|
|
@ -83,7 +83,7 @@ describe Vagrant::BoxCollection do
|
||||||
|
|
||||||
# Attempt to add some V2 box with the same name
|
# Attempt to add some V2 box with the same name
|
||||||
box_path = environment.box2_file(:vmware)
|
box_path = environment.box2_file(:vmware)
|
||||||
expect { instance.add(box_path, prev_box_name, :vmware) }.
|
expect { instance.add(box_path, prev_box_name) }.
|
||||||
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue