commands/package: Nicer error if includes has symlinks [GH-3200]

This commit is contained in:
Mitchell Hashimoto 2014-04-09 10:52:33 -07:00
parent b20ff91784
commit d8ec7b02c4
4 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@ BUG FIXES:
fail [GH-3391]
- core: `vagrant` on Windows cmd.exe doesn't always exit with exit
code zero. [GH-3420]
- commands/package: Nice error if includes contain symlinks. [GH-3200]
- commands/rsync-auto: Don't crash if the machine can't be communicated
to. [GH-3419]
- guests/fedora: Fix hostname setting. [GH-3382]

View File

@ -72,6 +72,11 @@ module Vagrant
FileUtils.cp(from, to, :preserve => true)
end
end
rescue Errno::EEXIST => e
raise if !e.to_s.include?("symlink")
# The directory contains symlinks. Show a nicer error.
raise Errors::PackageIncludeSymlink
end
# Compress the exported file into a package

View File

@ -456,6 +456,10 @@ module Vagrant
error_key(:include_file_missing, "vagrant.actions.general.package")
end
class PackageIncludeSymlink < VagrantError
error_key(:package_include_symlink)
end
class PackageOutputDirectory < VagrantError
error_key(:output_is_directory, "vagrant.actions.general.package")
end

View File

@ -789,6 +789,10 @@ en:
You can however, install a plugin with the same name to replace
these plugins. User-installed plugins take priority over
system-installed plugins.
package_include_symlink: |-
A file or directory you're attempting to include with your packaged
box has symlinks in it. Vagrant cannot include symlinks in the
resulting package. Please remove the symlinks and try again.
provider_not_found: |-
The provider '%{provider}' could not be found, but was requested to
back the machine '%{machine}'. Please use a provider that exists.