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