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
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/syncer/command/rsync_auto.rb', line 21
def execute
@logger = Log4r::Logger.new("vagrant::commands::rsync-auto")
options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant rsync-auto [vm-name]"
o.separator ""
o.separator "Options:"
o.separator ""
o.on("--[no-]poll", "Force polling filesystem (slow)") do |poll|
options[:poll] = poll
end
end
argv = parse_options(opts)
return unless argv
machine_threads = []
with_target_vms(argv) do |machine|
if machine.provider.capability?(:proxy_machine)
proxy = machine.provider.capability(:proxy_machine)
if proxy
machine.ui.warn(I18n.t(
"vagrant.rsync_proxy_machine",
name: machine.name.to_s,
provider: machine.provider_name.to_s
))
machine = proxy
end
end
next unless machine.communicate.ready?
next unless synced_folders(machine)[:rsync]
if machine.ssh_info
target_machine = Machine.new(machine)
machine_threads << Thread.new do
target_machine.full_sync
target_machine.listen(options[:poll])
end
end
end
machine_threads.each { |t| t.join }
return 0
end
|