Merge pull request #3364 from berendt/fix_issue_3344
core: handle exception when removing a non existing box version
This commit is contained in:
commit
4c90a5d002
|
@ -65,6 +65,14 @@ module Vagrant
|
||||||
box = env[:box_collection].find(
|
box = env[:box_collection].find(
|
||||||
box_name, box_provider, box_version)
|
box_name, box_provider, box_version)
|
||||||
|
|
||||||
|
if box == nil
|
||||||
|
raise Errors::BoxRemoveVersionNotFound,
|
||||||
|
name: box_name,
|
||||||
|
provider: box_provider.to_s,
|
||||||
|
version: box_version,
|
||||||
|
versions: all_versions.join(", ")
|
||||||
|
end
|
||||||
|
|
||||||
env[:ui].info(I18n.t("vagrant.commands.box.removing",
|
env[:ui].info(I18n.t("vagrant.commands.box.removing",
|
||||||
:name => box.name,
|
:name => box.name,
|
||||||
:provider => box.provider))
|
:provider => box.provider))
|
||||||
|
|
|
@ -196,6 +196,10 @@ module Vagrant
|
||||||
error_key(:box_remove_provider_not_found)
|
error_key(:box_remove_provider_not_found)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class BoxRemoveVersionNotFound < VagrantError
|
||||||
|
error_key(:box_remove_version_not_found)
|
||||||
|
end
|
||||||
|
|
||||||
class BoxRemoveMultiProvider < VagrantError
|
class BoxRemoveMultiProvider < VagrantError
|
||||||
error_key(:box_remove_multi_provider)
|
error_key(:box_remove_multi_provider)
|
||||||
end
|
end
|
||||||
|
|
|
@ -433,6 +433,13 @@ en:
|
||||||
the provider specified. Please double-check and try again.
|
the provider specified. Please double-check and try again.
|
||||||
|
|
||||||
The providers for this are: %{providers}
|
The providers for this are: %{providers}
|
||||||
|
box_remove_version_not_found: |-
|
||||||
|
You requested to remove the box '%{name}' with provider
|
||||||
|
'%{provider}' in version '%{version}'. The box '%{name}'
|
||||||
|
exists but not in the specified version '%{version}'.
|
||||||
|
Please double-check and try again.
|
||||||
|
|
||||||
|
The available versions for this box are: %{versions}
|
||||||
box_server_not_set: |-
|
box_server_not_set: |-
|
||||||
A URL to a Vagrant Cloud server is not set, so boxes cannot
|
A URL to a Vagrant Cloud server is not set, so boxes cannot
|
||||||
be added with a shorthand ("mitchellh/precise64") format.
|
be added with a shorthand ("mitchellh/precise64") format.
|
||||||
|
|
Loading…
Reference in New Issue