You can no longer output a package to a directory [GH-730]
This commit is contained in:
parent
99ec766efe
commit
5c49d693d4
|
@ -13,6 +13,7 @@
|
|||
- Fix issue with Puppet config inheritance. [GH-722]
|
||||
- Fix issue where starting a VM on some systems was incorrectly treated
|
||||
as failing. [GH-720]
|
||||
- It is now an error to specify the packaging `output` as a directory. [GH-730]
|
||||
|
||||
## 0.9.7 (February 9, 2012)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ module Vagrant
|
|||
def call(env)
|
||||
@env = env
|
||||
|
||||
raise Errors::PackageOutputDirectory if File.directory?(tar_path)
|
||||
raise Errors::PackageOutputExists if File.exist?(tar_path)
|
||||
raise Errors::PackageRequiresDirectory if !env["package.directory"] ||
|
||||
!File.directory?(env["package.directory"])
|
||||
|
@ -37,12 +38,14 @@ module Vagrant
|
|||
end
|
||||
|
||||
def recover(env)
|
||||
# Don't delete the tar_path if the error is that the output already
|
||||
# exists, since this will nuke the user's previous file.
|
||||
if !env["vagrant.error"].is_a?(Errors::PackageOutputExists)
|
||||
# Cleanup any packaged files if the packaging failed at some point.
|
||||
File.delete(tar_path) if File.exist?(tar_path)
|
||||
# There are certain exceptions that we don't delete the file for.
|
||||
ignore_exc = [Errors::PackageOutputDirectory, Errors::PackageOutputExists]
|
||||
ignore_exc.each do |exc|
|
||||
return if env["vagrant.error"].is_a?(exc)
|
||||
end
|
||||
|
||||
# Cleanup any packaged files if the packaging failed at some point.
|
||||
File.delete(tar_path) if File.exist?(tar_path)
|
||||
end
|
||||
|
||||
# This method copies the include files (passed in via command line)
|
||||
|
@ -90,7 +93,7 @@ module Vagrant
|
|||
|
||||
# Path to the final box output file
|
||||
def tar_path
|
||||
File.join(FileUtils.pwd, @env["package.output"])
|
||||
File.expand_path(@env["package.output"], FileUtils.pwd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -263,6 +263,11 @@ module Vagrant
|
|||
error_key(:include_file_missing, "vagrant.actions.general.package")
|
||||
end
|
||||
|
||||
class PackageOutputDirectory < VagrantError
|
||||
status_code(72)
|
||||
error_key(:output_is_directory, "vagrant.actions.general.package")
|
||||
end
|
||||
|
||||
class PackageOutputExists < VagrantError
|
||||
status_code(16)
|
||||
error_key(:output_exists, "vagrant.actions.general.package")
|
||||
|
|
|
@ -540,6 +540,9 @@ en:
|
|||
output_exists: |-
|
||||
The specified file to save the package as already exists. Please
|
||||
remove this file or specify a different file name for outputting.
|
||||
output_is_directory: |-
|
||||
The specified output is a directory. Please specify a path including
|
||||
a filename.
|
||||
requires_directory: |-
|
||||
A directory was not specified to package. This should never happen
|
||||
and is a result of an internal inconsistency.
|
||||
|
|
Loading…
Reference in New Issue