12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/vagrant/zscp/command/zscp.rb', line 12
def execute
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant zscp [vm-name]"
o.separator ""
end
argv = parse_options(opts)
return if !argv
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
folders = synced_folders(machine, cached: true)[:zscp]
next if !folders || folders.empty?
ssh_info = machine.ssh_info
foreach_folder(folders) do |folder_opts|
ZscpHelper.cleanup(machine, ssh_info, folder_opts)
end
foreach_folder(folders) do |folder_opts|
ZscpHelper.scp(machine, ssh_info, folder_opts)
end
end
return error ? 1 : 0
end
|