Sha256: 3c4825122f59a32a8480de58df9f72070375697e756c7c7127d7cd9bbbd25e10
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require "log4r" require "vagrant/util/retryable" module VagrantPlugins module SyncedFolderWinRM class SyncedFolder < Vagrant.plugin("2", :synced_folder) include Vagrant::Util::Retryable def initialize(*args) super @logger = Log4r::Logger.new("vagrant::synced_folders::winrm") end def usable?(machine, _raise_error = false) machine.config.vm.communicator == :winrm end def prepare(_machine, _folders, _opts) end def enable(machine, folders, _nfsopts) folders.each do |_id, data| hostpath = File.expand_path(data[:hostpath], machine.env.root_path) guestpath = data[:guestpath] machine.ui.info("Uploading with WinRM: #{hostpath} => #{guestpath}") machine.communicate.tap do |comm| # When syncing many files, we've see SEC_E_INVALID_TOKEN errors # that appear to be transient (try again and it goes away). Let's # retry a few times to add some robustness. attempts = 1 retryable(tries: 3, sleep: 1) do @logger.debug("Attempting WinRM upload attempt number #{attempts}") comm.upload(hostpath, guestpath) attempts += 1 end end end end def cleanup(_machine, _opts) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-winrm-syncedfolders-0.1.0 | lib/vagrant-winrm-syncedfolders/synced_folder.rb |