18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/vagrant-solaris10/cap/mount_nfs_folder.rb', line 18
def self.mount_nfs_folder(machine, ip, folders)
folders.each do |name, opts|
expanded_guest_path = machine.guest.capability(
:shell_expand_guest_path, opts[:guestpath])
if machine.communicate.test("test -L \"#{expanded_guest_path}\"", sudo: true)
machine.communicate.sudo("rm -f \"#{expanded_guest_path}\"")
end
if !machine.communicate.test("test -d \"#{expanded_guest_path}\"", sudo: true)
machine.communicate.sudo("mkdir -p #{expanded_guest_path}")
end
mount_opts = ["vers=#{opts[:nfs_version]}"]
if opts[:mount_options]
mount_opts = opts[:mount_options].dup
end
mount_command = "mount -F nfs " +
"-o '#{mount_opts.join(",")}' " +
"'#{ip}:#{opts[:hostpath]}' '#{expanded_guest_path}'"
retryable(on: Vagrant::Errors::SolarisNFSMountFailed, tries: 10, sleep: 5) do
machine.communicate.sudo(
mount_command,
error_class: Vagrant::Errors::SolarisNFSMountFailed)
end
end
end
|