Skip to content

Commit

Permalink
kernel/v2: not an error if synced folder guest path is empty [GH-4833]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jul 6, 2015
1 parent 79115d1 commit f5e38a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 10 additions & 8 deletions plugins/kernel_v2/config/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -603,16 +603,18 @@ def validate(machine)
guestpath = Pathname.new(options[:guestpath])
hostpath = Pathname.new(options[:hostpath]).expand_path(machine.env.root_path)

if guestpath.relative? && guestpath.to_s !~ /^\w+:/
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",
if guestpath.to_s != ""
if guestpath.relative? && guestpath.to_s !~ /^\w+:/
errors << I18n.t("vagrant.config.vm.shared_folder_guestpath_relative",
path: options[:guestpath])
end
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])
used_guest_paths.add(options[:guestpath])
end
end

if !hostpath.directory? && !options[:create]
Expand Down
6 changes: 6 additions & 0 deletions test/unit/plugins/kernel_v2/config/vm_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ def find_network(name)
expect(sf["/vagrant"][:disabled]).to be_false
expect(sf["/vagrant"][:foo]).to eq(:bar)
end

it "is not an error if guest path is empty" do
subject.synced_folder(".", "")
subject.finalize!
assert_valid
end
end

describe "#usable_port_range" do
Expand Down

0 comments on commit f5e38a4

Please sign in to comment.