Sha256: 689e2106d5353b2eee6d6535dc872a19ef92cac51e9a7c310ffe63f63970b48d

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

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])

            # Create the folder
            machine.communicate.sudo("mkdir -p #{expanded_guest_path}")

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

Version data entries

9 entries across 6 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.4.2 plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-unbundled-1.8.4.1 plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-unbundled-1.8.1.2 plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-unbundled-1.8.1.1 plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/darwin/cap/mount_nfs_folder.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/guests/darwin/cap/mount_nfs_folder.rb