Sha256: fdbfe912e501703354698a9614b03eb5d63b288839262b57b07939c3ab626283
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require 'optparse' require "vagrant/action/builtin/mixin_synced_folders" require_relative "../helper" module Vagrant module Zscp module Command class Rsync < Vagrant.plugin("2", :command) include Vagrant::Action::Builtin::MixinSyncedFolders def execute opts = OptionParser.new do |o| o.banner = "Usage: vagrant zscp [vm-name]" o.separator "" end # Parse the options and return if we don't have any target. argv = parse_options(opts) return if !argv # Go through each machine and perform the rsync error = false with_target_vms(argv) do |machine| if machine.provider.capability?(:proxy_machine) proxy = machine.provider.capability(:proxy_machine) if proxy machine.ui.warn("vagrant.rsync_proxy_machine") machine = proxy end end if !machine.communicate.ready? machine.ui.error("vagrant.rsync_communicator_not_ready") error = true next end # Determine the rsync synced folders for this machine folders = synced_folders(machine, cached: true)[:zscp] next if !folders || folders.empty? # Get the SSH info for this machine so we can access it ssh_info = machine.ssh_info # Sync them! sync_threads = [] folders.each do |id, folder_opts| sync_threads << Thread.new(id, folder_opts) do |id, folder_opts| ZscpHelper.scp(machine, ssh_info, folder_opts) end end sync_threads.each do |t| t.join end end return error ? 1 : 0 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-zscp-0.1.4 | lib/vagrant/zscp/command/zscp.rb |
vagrant-zscp-0.1.3 | lib/vagrant/zscp/command/zscp.rb |