More comprehensive synced folder validation [GH-1499]
This commit is contained in:
parent
b32c0d16ac
commit
40250843b3
|
@ -8,6 +8,7 @@ IMPROVEMENTS:
|
||||||
Vagrant errors much quieter when developing plugins.
|
Vagrant errors much quieter when developing plugins.
|
||||||
- Vagrant will detect Bundler environments, make assumptions that you're
|
- Vagrant will detect Bundler environments, make assumptions that you're
|
||||||
developing plugins, and will quiet its error output a bit.
|
developing plugins, and will quiet its error output a bit.
|
||||||
|
- More comprehensive synced folder configuration validation.
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
|
|
@ -249,8 +249,25 @@ module VagrantPlugins
|
||||||
@hostname && @hostname !~ /^[-.a-z0-9]+$/i
|
@hostname && @hostname !~ /^[-.a-z0-9]+$/i
|
||||||
|
|
||||||
has_nfs = false
|
has_nfs = false
|
||||||
|
used_guest_paths = Set.new
|
||||||
@synced_folders.each do |id, options|
|
@synced_folders.each do |id, options|
|
||||||
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)
|
# If the shared folder is disabled then don't worry about validating it
|
||||||
|
next if options[:disabled]
|
||||||
|
|
||||||
|
guestpath = Pathname.new(options[:guestpath])
|
||||||
|
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)
|
||||||
|
|
||||||
|
if guestpath.relative?
|
||||||
|
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
|
||||||
|
:path => options[:guestpath])
|
||||||
|
else
|
||||||
|
if used_guest_paths.include?(options[:guestpath])
|
||||||
|
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_duplicate",
|
||||||
|
:path => options[:guestpath])
|
||||||
|
end
|
||||||
|
|
||||||
|
used_guest_paths.add(options[:guestpath])
|
||||||
|
end
|
||||||
|
|
||||||
if !hostpath.directory? && !options[:create]
|
if !hostpath.directory? && !options[:create]
|
||||||
errors << I18n.t("vagrant.config.vm.shared_folder_hostpath_missing",
|
errors << I18n.t("vagrant.config.vm.shared_folder_hostpath_missing",
|
||||||
|
|
|
@ -486,6 +486,11 @@ en:
|
||||||
Forwarded port definitions require a "host" and "guest" value
|
Forwarded port definitions require a "host" and "guest" value
|
||||||
provisioner_not_found: |-
|
provisioner_not_found: |-
|
||||||
The '%{name}' provisioner could not be found.
|
The '%{name}' provisioner could not be found.
|
||||||
|
shared_folder_guestpath_duplicate: |-
|
||||||
|
A shared folder guest path is used multiple times. Shared
|
||||||
|
folders must all map to a unique guest path: %{path}
|
||||||
|
shared_folder_guestpath_relative: |-
|
||||||
|
The shared folder guest path must be absolute: %{path}
|
||||||
shared_folder_hostpath_missing: |-
|
shared_folder_hostpath_missing: |-
|
||||||
The host path of the shared folder is missing: %{path}
|
The host path of the shared folder is missing: %{path}
|
||||||
shared_folder_nfs_owner_group: |-
|
shared_folder_nfs_owner_group: |-
|
||||||
|
|
Loading…
Reference in New Issue