Sha256: 2be7f7406aa1d7871ed44f3d7be5ab16944522677a699168b6d38ca25200df70

Contents?: true

Size: 951 Bytes

Versions: 6

Compression:

Stored size: 951 Bytes

Contents

require "vagrant/util/retryable"

module VagrantPlugins
  module GuestDarwin
    module Cap
      class MountNFSFolder
        extend Vagrant::Util::Retryable
        def self.mount_nfs_folder(machine, ip, folders)
          folders.each do |name, opts|
            # Expand the guest path so we can handle things like "~/vagrant"
            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")

              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
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/guests/darwin/cap/mount_nfs_folder.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/guests/darwin/cap/mount_nfs_folder.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/guests/darwin/cap/mount_nfs_folder.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/guests/darwin/cap/mount_nfs_folder.rb
tnargav-1.3.6 plugins/guests/darwin/cap/mount_nfs_folder.rb
tnargav-1.3.3 plugins/guests/darwin/cap/mount_nfs_folder.rb