commands/box/repackage: better error if box not found

This commit is contained in:
Mitchell Hashimoto 2014-04-12 18:00:33 -07:00
parent 05018363d6
commit 00962c7c2a
3 changed files with 12 additions and 3 deletions

View File

@ -192,6 +192,10 @@ module Vagrant
error_key(:box_not_found_with_provider)
end
class BoxNotFoundWithProviderAndVersion < VagrantError
error_key(:box_not_found_with_provider_and_version)
end
class BoxProviderDoesntMatch < VagrantError
error_key(:box_provider_doesnt_match)
end

View File

@ -23,9 +23,10 @@ module VagrantPlugins
# Verify the box exists that we want to repackage
box = @env.boxes.find(box_name, box_provider, "= #{box_version}")
if !box
raise Vagrant::Errors::BoxNotFound,
:name => box_name,
:provider => box_provider
raise Vagrant::Errors::BoxNotFoundWithProviderAndVersion,
name: box_name,
provider: box_provider.to_s,
version: box_version
end
# Repackage the box

View File

@ -443,6 +443,10 @@ en:
the box are shown below:
%{providers}
box_not_found_with_provider_and_version: |-
The box '%{name}' (v%{version}) with provider '%{provider}'
could not be found. Please double check and try again. You
can see all the boxes that are installed with `vagrant box list`.
box_provider_doesnt_match: |-
The box you attempted to add doesn't match the provider you specified.