plugins/kernel_v2/config/vm.rb in vagrant-unbundled-1.8.5.2 vs plugins/kernel_v2/config/vm.rb in vagrant-unbundled-1.9.1.1
- old
+ new
@@ -205,21 +205,33 @@
# On Windows, Ruby just uses normal '/' for path seps, so
# just replace normal Windows style seps with Unix ones.
hostpath = hostpath.to_s.gsub("\\", "/")
end
+ if guestpath.is_a?(Hash)
+ options = guestpath
+ guestpath = nil
+ end
+
options ||= {}
+
+ if options.has_key?(:name)
+ synced_folder_name = options.delete(:name)
+ else
+ synced_folder_name = guestpath
+ end
+
options[:guestpath] = guestpath.to_s.gsub(/\/$/, '')
options[:hostpath] = hostpath
options[:disabled] = false if !options.key?(:disabled)
options = (@__synced_folders[options[:guestpath]] || {}).
merge(options.dup)
# Make sure the type is a symbol
options[:type] = options[:type].to_sym if options[:type]
- @__synced_folders[options[:guestpath]] = options
+ @__synced_folders[synced_folder_name] = options
end
# Define a way to access the machine via a network. This exposes a
# high-level abstraction for networking that may not directly map
# 1-to-1 for every provider. For example, AWS has no equivalent to
@@ -579,11 +591,11 @@
errors << I18n.t("vagrant.config.vm.hostname_invalid_characters") if \
@hostname && @hostname !~ /^[a-z0-9][-.a-z0-9]*$/i
if @box_version
- @box_version.split(",").each do |v|
+ @box_version.to_s.split(",").each do |v|
begin
Gem::Requirement.new(v.strip)
rescue Gem::Requirement::BadRequirementError
errors << I18n.t(
"vagrant.config.vm.bad_version", version: v)
@@ -624,10 +636,10 @@
used_guest_paths = Set.new
@__synced_folders.each do |id, options|
# If the shared folder is disabled then don't worry about validating it
next if options[:disabled]
- guestpath = Pathname.new(options[:guestpath])
+ guestpath = Pathname.new(options[:guestpath]) if options[:guestpath]
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)
if guestpath.to_s != ""
if guestpath.relative? && guestpath.to_s !~ /^\w+:/
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",