Error message for improperly packaged boxes [GH-198]

This commit is contained in:
Mitchell Hashimoto 2011-12-10 21:49:00 -08:00
parent 7d8f6e511b
commit 98b8d858c4
4 changed files with 15 additions and 1 deletions

View File

@ -8,6 +8,7 @@
power off the system. [GH-575] power off the system. [GH-575]
- Tweaks to SSH to hopefully be more reliable in coming up. - Tweaks to SSH to hopefully be more reliable in coming up.
- Helpful error message when SCP is unavailable in the guest. [GH-568] - Helpful error message when SCP is unavailable in the guest. [GH-568]
- Error message for improperly packaged box files. [GH-198]
## 0.8.10 (December 10, 2011) ## 0.8.10 (December 10, 2011)

View File

@ -48,7 +48,11 @@ module Vagrant
def decompress def decompress
Dir.chdir(@env["box_directory"]) do Dir.chdir(@env["box_directory"]) do
@env[:ui].info I18n.t("vagrant.actions.box.unpackage.extracting") @env[:ui].info I18n.t("vagrant.actions.box.unpackage.extracting")
begin
Archive::Tar::Minitar.unpack(@env["download.temp_path"], @env["box_directory"].to_s) Archive::Tar::Minitar.unpack(@env["download.temp_path"], @env["box_directory"].to_s)
rescue SystemCallError
raise Errors::BoxUnpackageFailure
end
end end
end end
end end

View File

@ -118,6 +118,11 @@ module Vagrant
error_key(:does_not_exist, "vagrant.actions.vm.check_box") error_key(:does_not_exist, "vagrant.actions.vm.check_box")
end end
class BoxUnpackageFailure < VagrantError
status_code(57)
error_key(:untar_failure, "vagrant.actions.box.unpackage")
end
class BoxVerificationFailed < VagrantError class BoxVerificationFailed < VagrantError
status_code(15) status_code(15)
error_key(:failed, "vagrant.actions.box.verify") error_key(:failed, "vagrant.actions.box.verify")

View File

@ -432,6 +432,10 @@ en:
A box already exists under the name of '%{name}'. This may or may A box already exists under the name of '%{name}'. This may or may
not be the same box you are trying to add. Please use another name not be the same box you are trying to add. Please use another name
or remove the previous box then try to add it again. or remove the previous box then try to add it again.
untar_failure: |-
Failed to untar the box file. This is usually because you're
attempting to add a box that isn't a valid box file. Please
double check that the box file is properly packaged.
verify: verify:
verifying: "Verifying box..." verifying: "Verifying box..."
failed: |- failed: |-