propagate unset guestpath
This commit is contained in:
parent
addc7576cc
commit
7fb9d3eb4f
|
@ -218,7 +218,7 @@ module VagrantPlugins
|
||||||
synced_folder_name = guestpath
|
synced_folder_name = guestpath
|
||||||
end
|
end
|
||||||
|
|
||||||
options[:guestpath] = guestpath.to_s.gsub(/\/$/, '')
|
options[:guestpath] = guestpath.to_s.gsub(/\/$/, '') if guestpath
|
||||||
options[:hostpath] = hostpath
|
options[:hostpath] = hostpath
|
||||||
options[:disabled] = false if !options.key?(:disabled)
|
options[:disabled] = false if !options.key?(:disabled)
|
||||||
options = (@__synced_folders[options[:guestpath]] || {}).
|
options = (@__synced_folders[options[:guestpath]] || {}).
|
||||||
|
@ -641,7 +641,9 @@ module VagrantPlugins
|
||||||
guestpath = Pathname.new(options[:guestpath]) if options[:guestpath]
|
guestpath = Pathname.new(options[:guestpath]) if options[:guestpath]
|
||||||
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)
|
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)
|
||||||
|
|
||||||
if guestpath.to_s != ""
|
if guestpath.to_s == "" && id.to_s == ""
|
||||||
|
errors << I18n.t("vagrant.config.vm.shared_folder_requires_guestpath_or_name")
|
||||||
|
elsif guestpath.to_s != ""
|
||||||
if guestpath.relative? && guestpath.to_s !~ /^\w+:/
|
if guestpath.relative? && guestpath.to_s !~ /^\w+:/
|
||||||
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
|
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
|
||||||
path: options[:guestpath])
|
path: options[:guestpath])
|
||||||
|
|
|
@ -1789,6 +1789,8 @@ en:
|
||||||
shared_folder_mount_options_array: |-
|
shared_folder_mount_options_array: |-
|
||||||
Shared folder mount options specified by 'mount_options' must
|
Shared folder mount options specified by 'mount_options' must
|
||||||
be an array of options.
|
be an array of options.
|
||||||
|
shared_folder_requires_guestpath_or_name: |-
|
||||||
|
Shared folder options must include a guestpath and/or name.
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Translations for commands. e.g. `vagrant x`
|
# Translations for commands. e.g. `vagrant x`
|
||||||
|
|
|
@ -557,8 +557,8 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
||||||
expect(sf["/vagrant"][:foo]).to eq(:bar)
|
expect(sf["/vagrant"][:foo]).to eq(:bar)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is not an error if guest path is empty" do
|
it "is not an error if guest path is empty but name is not" do
|
||||||
subject.synced_folder(".", "")
|
subject.synced_folder(".", "", name: "my-vagrant-folder")
|
||||||
subject.finalize!
|
subject.finalize!
|
||||||
assert_valid
|
assert_valid
|
||||||
end
|
end
|
||||||
|
@ -577,6 +577,18 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
|
||||||
expect(sf).to have_key("my-vagrant-folder")
|
expect(sf).to have_key("my-vagrant-folder")
|
||||||
expect(sf["my-vagrant-folder"][:hostpath]).to eq(".")
|
expect(sf["my-vagrant-folder"][:hostpath]).to eq(".")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "requires either guest path or name" do
|
||||||
|
subject.synced_folder(".", name: nil, guestpath: nil)
|
||||||
|
subject.finalize!
|
||||||
|
assert_invalid
|
||||||
|
end
|
||||||
|
|
||||||
|
it "keeps nil guest path if not provided" do
|
||||||
|
subject.synced_folder(".", name: "my-vagrant-folder")
|
||||||
|
sf = subject.synced_folders
|
||||||
|
expect(sf["my-vagrant-folder"][:guestpath]).to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#usable_port_range" do
|
describe "#usable_port_range" do
|
||||||
|
|
Loading…
Reference in New Issue