guests/darwin: respect NFS mount options [GH-3791]

This commit is contained in:
Mitchell Hashimoto 2014-05-17 12:24:24 -07:00
parent 72de106c8f
commit 9c7fb05d5f
2 changed files with 18 additions and 5 deletions

View File

@ -16,6 +16,7 @@ BUG FIXES:
`docker stop`. [GH-3798]
- provisioners/puppet: Fix setting facter vars with Windows
guests. [GH-3776]
- guests/darwin: Respect mount options for NFS. [GH-3791]
- guests/freebsd: Properly register the rsync_pre capability
- guests/windows: Certain executed provisioners won't leave output
and exit status behind. [GH-3729]

View File

@ -11,12 +11,24 @@ module VagrantPlugins
expanded_guest_path = machine.guest.capability(
:shell_expand_guest_path, opts[:guestpath])
machine.communicate.sudo("if [ ! -d #{expanded_guest_path} ]; then mkdir -p #{expanded_guest_path};fi")
# Create the folder
machine.communicate.sudo("mkdir -p #{expanded_guest_path}")
mount_command = "mount -t nfs '#{ip}:#{opts[:hostpath]}' '#{expanded_guest_path}'"
retryable(:on => Vagrant::Errors::DarwinNFSMountFailed, :tries => 10, :sleep => 5) do
machine.communicate.sudo(mount_command, :error_class => Vagrant::Errors::DarwinNFSMountFailed)
end
# Figure out any options
mount_opts = ["vers=#{opts[:nfs_version]}"]
mount_opts << "udp" if opts[:nfs_udp]
if opts[:mount_options]
mount_opts = opts[:mount_options].dup
end
mount_command = "mount -t nfs " +
"-o '#{mount_opts.join(",")}' " +
"'#{ip}:#{opts[:hostpath]}' '#{expanded_guest_path}'"
retryable(:on => Vagrant::Errors::DarwinNFSMountFailed, :tries => 10, :sleep => 5) do
machine.communicate.sudo(
mount_command,
error_class: Vagrant::Errors::DarwinNFSMountFailed)
end
end
end
end