core: don't allow version for old-style box [GH-3260]
This commit is contained in:
parent
2e0142168e
commit
32d86ca42b
|
@ -24,6 +24,7 @@ BUG FIXES:
|
||||||
- core: Better error message when adding a box with a malformed version. [GH-3332]
|
- core: Better error message when adding a box with a malformed version. [GH-3332]
|
||||||
- core: Fix a rare issue where vagrant up would complain it couldn't
|
- core: Fix a rare issue where vagrant up would complain it couldn't
|
||||||
check version of a box that doesn't exist. [GH-3326]
|
check version of a box that doesn't exist. [GH-3326]
|
||||||
|
- core: Box version constraint can't be specified with old-style box. [GH-3260]
|
||||||
- commands/box: Show versions when listing. [GH-3316]
|
- commands/box: Show versions when listing. [GH-3316]
|
||||||
- commands/box: Outdated check can list local boxes that are newer. [GH-3321]
|
- commands/box: Outdated check can list local boxes that are newer. [GH-3321]
|
||||||
- commands/status: Machine readable output contains the target. [GH-3218]
|
- commands/status: Machine readable output contains the target. [GH-3218]
|
||||||
|
|
|
@ -119,6 +119,10 @@ module Vagrant
|
||||||
raise Errors::BoxAddNameRequired
|
raise Errors::BoxAddNameRequired
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if env[:box_version]
|
||||||
|
raise Errors::BoxAddDirectVersion
|
||||||
|
end
|
||||||
|
|
||||||
provider = env[:box_provider]
|
provider = env[:box_provider]
|
||||||
provider = Array(provider) if provider
|
provider = Array(provider) if provider
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,10 @@ module Vagrant
|
||||||
error_key(:batch_multi_error)
|
error_key(:batch_multi_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class BoxAddDirectVersion < VagrantError
|
||||||
|
error_key(:box_add_direct_version)
|
||||||
|
end
|
||||||
|
|
||||||
class BoxAddMetadataMultiURL < VagrantError
|
class BoxAddMetadataMultiURL < VagrantError
|
||||||
error_key(:box_add_metadata_multi_url)
|
error_key(:box_add_metadata_multi_url)
|
||||||
end
|
end
|
||||||
|
|
|
@ -336,6 +336,11 @@ en:
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
Provider: %{provider}
|
Provider: %{provider}
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
|
box_add_direct_version: |-
|
||||||
|
You specified a box version constraint with a direct box file
|
||||||
|
path. Box version constraints only work with boxes from Vagrant
|
||||||
|
Cloud or a custom box host. Please remove the version constraint
|
||||||
|
and try again.
|
||||||
box_add_metadata_multi_url: |-
|
box_add_metadata_multi_url: |-
|
||||||
Multiple URLs for a box can't be specified when adding
|
Multiple URLs for a box can't be specified when adding
|
||||||
versioned boxes. Please specify a single URL to the box
|
versioned boxes. Please specify a single URL to the box
|
||||||
|
|
|
@ -177,6 +177,21 @@ describe Vagrant::Action::Builtin::BoxAdd do
|
||||||
to raise_error(Vagrant::Errors::DownloaderError)
|
to raise_error(Vagrant::Errors::DownloaderError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "raises an error if a version was specified" do
|
||||||
|
box_path = iso_env.box2_file(:virtualbox)
|
||||||
|
|
||||||
|
env[:box_name] = "foo"
|
||||||
|
env[:box_url] = box_path.to_s
|
||||||
|
env[:box_version] = "1"
|
||||||
|
|
||||||
|
expect(box_collection).to receive(:add).never
|
||||||
|
|
||||||
|
expect(app).to receive(:call).never
|
||||||
|
|
||||||
|
expect { subject.call(env) }.
|
||||||
|
to raise_error(Vagrant::Errors::BoxAddDirectVersion)
|
||||||
|
end
|
||||||
|
|
||||||
it "force adds if exists and specified" do
|
it "force adds if exists and specified" do
|
||||||
box_path = iso_env.box2_file(:virtualbox)
|
box_path = iso_env.box2_file(:virtualbox)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue