Skip to content

Commit

Permalink
Merge pull request hashicorp#4867 from malonecm/GH4201-ShowRSyncOutput
Browse files Browse the repository at this point in the history
hashicorpGH-4201: Added rsync__showoutput to display rsync output to console
  • Loading branch information
sethvargo committed May 31, 2015
2 parents 25486f0 + dd62d3c commit f9816d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion plugins/synced_folders/rsync/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,24 @@ def self.rsync_single(machine, ssh_info, opts)
machine.ui.info(I18n.t(
"vagrant.rsync_folder_excludes", excludes: excludes.inspect))
end
if opts.include?(:verbose)
machine.ui.info(I18n.t("vagrant.rsync_showing_output"));
end

# If we have tasks to do before rsyncing, do those.
if machine.guest.capability?(:rsync_pre)
machine.guest.capability(:rsync_pre, opts)
end

r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))
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}") }
}
else
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))
end

if r.exit_code != 0
raise Vagrant::Errors::RSyncError,
command: command.join(" "),
Expand Down
1 change: 1 addition & 0 deletions templates/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ en:
The provider ('%{provider}') for the machine '%{name}' is
using a proxy machine. RSync will sync to this proxy
instead of directly to the environment itself.
rsync_showing_output: "Showing rsync output..."
rsync_ssh_password: |-
The machine you're rsyncing folders to is configured to use
password-based authentication. Vagrant can't script rsync to automatically
Expand Down
4 changes: 4 additions & 0 deletions website/docs/source/v2/synced-folders/rsync.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ 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__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.

## Example

The following is an example of using RSync to sync a folder:
Expand Down

0 comments on commit f9816d8

Please sign in to comment.