mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-27 12:17:38 -04:00
Merge 1a8c8b5af9 into f9e2630d69
This commit is contained in:
commit
64a513f409
2 changed files with 19 additions and 0 deletions
|
|
@ -21,6 +21,11 @@ module VagrantPlugins
|
|||
|
||||
@@logger.debug("Mounting #{name} (#{options[:hostpath]} to #{guestpath})")
|
||||
|
||||
if mounted?(machine, guest_path)
|
||||
@@logger.info("Skipping mount: #{guest_path} is already mounted")
|
||||
return
|
||||
end
|
||||
|
||||
builtin_mount_type = "-cit #{mount_type}"
|
||||
addon_mount_type = "-t #{mount_type}"
|
||||
|
||||
|
|
@ -72,6 +77,10 @@ module VagrantPlugins
|
|||
machine.communicate.sudo("rmdir #{guest_path}", error_check: false)
|
||||
end
|
||||
end
|
||||
|
||||
def self.mounted?(machine, guest_path)
|
||||
machine.communicate.test("mountpoint -q #{guest_path}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -94,6 +94,16 @@ EOF
|
|||
cap.mount_virtualbox_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
||||
end
|
||||
end
|
||||
|
||||
context "already mounted" do
|
||||
it "skips mounting if already mounted" do
|
||||
expect(folder_plugin).to receive(:capability).with(:mount_type).and_return("vboxsf")
|
||||
expect(comm).to receive(:test).with("mountpoint -q #{mount_guest_path}").and_return(true)
|
||||
expect(comm).not_to receive(:sudo).with(/mount/)
|
||||
|
||||
cap.mount_virtualbox_shared_folder(machine, mount_name, mount_guest_path, folder_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".unmount_virtualbox_shared_folder" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue