GH-4201: Added rsync__showoutput to display rsync output to console

This commit is contained in:
Chad Maloney 2014-11-25 12:38:41 -06:00
parent 1c884fa4e5
commit 5de3f30bb0
4 changed files with 18 additions and 1 deletions

View File

@ -40,6 +40,8 @@ IMPROVEMENTS:
- synced\_folders/nfs: Won't use `sudo` to write to /etc/exports if there - synced\_folders/nfs: Won't use `sudo` to write to /etc/exports if there
are write privileges. [GH-2643] are write privileges. [GH-2643]
- synced\_folders/smb: Credentials from one SMB will be copied to the rest. [GH-4675] - synced\_folders/smb: Credentials from one SMB will be copied to the rest. [GH-4675]
- synced\_filders/rsync: Added rsync__showoutput option to echo rsync output
to console [GH-4201]
BUG FIXES: BUG FIXES:

View File

@ -121,13 +121,23 @@ module VagrantPlugins
machine.ui.info(I18n.t( machine.ui.info(I18n.t(
"vagrant.rsync_folder_excludes", excludes: excludes.inspect)) "vagrant.rsync_folder_excludes", excludes: excludes.inspect))
end end
if opts.include?(:showoutput)
machine.ui.info(I18n.t("vagrant.rsync_showingoutput"));
end
# If we have tasks to do before rsyncing, do those. # If we have tasks to do before rsyncing, do those.
if machine.guest.capability?(:rsync_pre) if machine.guest.capability?(:rsync_pre)
machine.guest.capability(:rsync_pre, opts) machine.guest.capability(:rsync_pre, opts)
end end
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) if opts.include?(:showoutput)
command_opts[:notify] = [ :stdout, :stderr ];
r = Vagrant::Util::Subprocess.execute(
*(command + [command_opts])) { |io_name,data| machine.ui.info("rsync[#{io_name}] -> #{data}") }
else
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))
end
if r.exit_code != 0 if r.exit_code != 0
raise Vagrant::Errors::RSyncError, raise Vagrant::Errors::RSyncError,
command: command.join(" "), command: command.join(" "),

View File

@ -212,6 +212,7 @@ en:
The provider ('%{provider}') for the machine '%{name}' is The provider ('%{provider}') for the machine '%{name}' is
using a proxy machine. RSync will sync to this proxy using a proxy machine. RSync will sync to this proxy
instead of directly to the environment itself. instead of directly to the environment itself.
rsync_showing_output: "Showing rsync output..."
rsync_ssh_password: |- rsync_ssh_password: |-
The machine you're rsyncing folders to is configured to use The machine you're rsyncing folders to is configured to use
password-based authentication. Vagrant can't script rsync to automatically password-based authentication. Vagrant can't script rsync to automatically

View File

@ -62,6 +62,10 @@ 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__showoutput` (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.
## Example ## Example
The following is an example of using RSync to sync a folder: The following is an example of using RSync to sync a folder: