Sha256: 801b0af51bfc3a614bb567f35ad306b66cbe33c93a4b05395cb4ddc1994919ee

Contents?: true

Size: 1017 Bytes

Versions: 6

Compression:

Stored size: 1017 Bytes

Contents

require "vagrant/util/retryable"

module VagrantPlugins
  module GuestLinux
    module Cap
      class MountNFS
        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])

            # Do the actual creating and mounting
            machine.communicate.sudo("mkdir -p #{expanded_guest_path}")

            # Mount
            mount_command = "mount -o vers=#{opts[:nfs_version]} #{ip}:'#{opts[:hostpath]}' #{expanded_guest_path}"

            retryable(:on => Vagrant::Errors::LinuxNFSMountFailed, :tries => 5, :sleep => 2) do
              machine.communicate.sudo(mount_command,
                                       :error_class => Vagrant::Errors::LinuxNFSMountFailed)
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/guests/linux/cap/mount_nfs.rb
tnargav-1.2.3 plugins/guests/linux/cap/mount_nfs.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/plugins/guests/linux/cap/mount_nfs.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/plugins/guests/linux/cap/mount_nfs.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/plugins/guests/linux/cap/mount_nfs.rb
tnargav-1.2.2 plugins/guests/linux/cap/mount_nfs.rb