Sha256: bb19c4cc4e260833f18e5ff33e9723101b18a1f16048e7d7c6dce0e2bc0f6e68

Contents?: true

Size: 1.4 KB

Versions: 47

Compression:

Stored size: 1.4 KB

Contents

require_relative "../../../synced_folders/unix_mount_helpers"

module VagrantPlugins
  module GuestTinyCore
    module Cap
      class MountNFS
        extend SyncedFolder::UnixMountHelpers

        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
            hostpath = opts[:hostpath].dup
            hostpath.gsub!("'", "'\\\\''")

            # 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.nfs -o '#{mount_opts.join(",")}' #{ip}:'#{hostpath}' #{expanded_guest_path}"
            retryable(on: Vagrant::Errors::NFSMountFailed, tries: 8, sleep: 3) do
              machine.communicate.sudo(mount_command,
                                       error_class: Vagrant::Errors::NFSMountFailed)
            end

            emit_upstart_notification(machine, expanded_guest_path)
          end
        end
      end
    end
  end
end

Version data entries

47 entries across 43 versions & 5 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/guests/tinycore/cap/mount_nfs.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.3.3.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.3.2.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.19.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.18.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.16.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.14.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.10.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.9.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.8.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.7.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.6.2 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.6.1 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.6.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.5.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.4.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.3.0 plugins/guests/tinycore/cap/mount_nfs.rb
vagrant-unbundled-2.2.2.0 plugins/guests/tinycore/cap/mount_nfs.rb