synced_folders/rsync: can set rsync_path [GH-3966]

This commit is contained in:
Mitchell Hashimoto 2015-07-09 10:02:38 -06:00
parent 26b5b67a6c
commit 31448d126b
2 changed files with 15 additions and 6 deletions

View File

@ -98,8 +98,12 @@ module VagrantPlugins
args << "--no-group" unless args.include?("--group") || args.include?("-g") args << "--no-group" unless args.include?("--group") || args.include?("-g")
# Tell local rsync how to invoke remote rsync with sudo # Tell local rsync how to invoke remote rsync with sudo
if machine.guest.capability?(:rsync_command) rsync_path = opts[:rsync_path]
args << "--rsync-path"<< machine.guest.capability(:rsync_command) if !rsync_path && machine.guest.capability?(:rsync_command)
rsync_path = machine.guest.capability(:rsync_command)
end
if rsync_path
args << "--rsync-path"<< rsync_path
end end
# Build up the actual command to execute # Build up the actual command to execute
@ -132,9 +136,10 @@ module VagrantPlugins
end end
if opts.include?(:verbose) if opts.include?(:verbose)
command_opts[:notify] = [ :stdout, :stderr ]; command_opts[:notify] = [:stdout, :stderr]
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) { r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) {
|io_name,data| data.each_line { |line| machine.ui.info("rsync[#{io_name}] -> #{line}") } |io_name,data| data.each_line { |line|
machine.ui.info("rsync[#{io_name}] -> #{line}") }
} }
else else
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))

View File

@ -62,9 +62,13 @@ The rsync synced folder type accepts the following options:
pattern. By default, the ".vagrant/" directory is excluded. We recommend pattern. By default, the ".vagrant/" directory is excluded. We recommend
excluding revision control directories such as ".git/" as well. excluding revision control directories such as ".git/" as well.
* `rsync__rsync_path` (string) - The path on the remote host where rsync
is and how it is executed. This is platform specific but defaults to
"sudo rsync" for many guests.
* `rsync__verbose` (boolean) - If true, then the output from the rsync * `rsync__verbose` (boolean) - If true, then the output from the rsync
process will be echoed to the console. The output of rsync is subject process will be echoed to the console. The output of rsync is subject
to rsync__args of course. By default, this is false. to `rsync__args` of course. By default, this is false.
## Example ## Example