Sha256: 5daa4364312f480dab637abe4c6051c704a13c40a2ba8b647a96fe1cae9dbeb7

Contents?: true

Size: 1.61 KB

Versions: 22

Compression:

Stored size: 1.61 KB

Contents

require "log4r"

require "vagrant/util/subprocess"
require "vagrant/util/which"

require_relative "helper"

module VagrantPlugins
  module SyncedFolderRSync
    class SyncedFolder < Vagrant.plugin("2", :synced_folder)
      include Vagrant::Util

      def initialize(*args)
        super

        @logger = Log4r::Logger.new("vagrant::synced_folders::rsync")
      end

      def usable?(machine, raise_error=false)
        rsync_path = Which.which("rsync")
        return true if rsync_path
        return false if !raise_error
        raise Vagrant::Errors::RSyncNotFound
      end

      def prepare(machine, folders, opts)
        # Nothing is necessary to do before VM boot.
      end

      def enable(machine, folders, opts)
        if machine.guest.capability?(:rsync_installed)
          installed = machine.guest.capability(:rsync_installed)
          if !installed
            can_install = machine.guest.capability?(:rsync_install)
            raise Vagrant::Errors::RSyncNotInstalledInGuest if !can_install
            machine.ui.info I18n.t("vagrant.rsync_installing")
            machine.guest.capability(:rsync_install)
          end
        end

        ssh_info = machine.ssh_info

        if ssh_info[:private_key_path].empty? && ssh_info[:password]
          machine.ui.warn(I18n.t("vagrant.rsync_ssh_password"))
        end

        folders.each do |id, folder_opts|
          RsyncHelper.rsync_single(machine, ssh_info, folder_opts)
        end
      end

      # Enable rsync synced folders within WSL when in use
      # on non-DrvFs file systems
      def self.wsl_allow_non_drvfs?
        true
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

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