Sha256: d9b609296a93aee9c4c983f5b21d138667065f60d96488eefb63a8fe9826b80d

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module VagrantPlugins
  module HostBSD
    class Host < Vagrant.plugin("2", :host)
      def mount_nfs_folders(id, ips, folders)
        @logger.debug "Mounting NFS mounts..."
        folders.each do |name, opts|
          @logger.info opts
          ips.each do |ip|
            system("mkdir -p #{opts[:hostpath]}")
            mount_command = "mount -t nfs -o noatime '#{ip}:#{opts[:guestpath]}' '#{opts[:hostpath]}'"
            if system(mount_command)
              break
            end
          end
        end
      end

      def unmount_nfs_folders(folders)
        @logger.debug "Unmounting NFS mounts..."
        folders.each do |name, opts|
          if opts[:type] == :nfs_guest
            expanded_host_path = `printf #{opts[:hostpath]}`
            if not system("umount '#{expanded_host_path}'")
              @ui.info "NFS mounts still in use!"
              exit(1)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-nfs_guest-0.0.3 lib/vagrant-nfs_guest/hosts/bsd/host.rb