synced_folders/rsync: don't crash if comm error during rsync-auto [GH-3419]
This commit is contained in:
parent
7ade8f8ad4
commit
800cf7539b
|
@ -6,6 +6,8 @@ BUG FIXES:
|
||||||
of Vagrant. [GH-3386]
|
of Vagrant. [GH-3386]
|
||||||
- core: Don't error if network problems cause box update check to
|
- core: Don't error if network problems cause box update check to
|
||||||
fail [GH-3391]
|
fail [GH-3391]
|
||||||
|
- commands/rsync-auto: Don't crash if the machine can't be communicated
|
||||||
|
to. [GH-3419]
|
||||||
- guests/fedora: Fix hostname setting. [GH-3382]
|
- guests/fedora: Fix hostname setting. [GH-3382]
|
||||||
- guests/fedora: Support predictable network interface names for
|
- guests/fedora: Support predictable network interface names for
|
||||||
public/private networks. [GH-3207]
|
public/private networks. [GH-3207]
|
||||||
|
|
|
@ -112,7 +112,14 @@ module VagrantPlugins
|
||||||
tosync.each do |folders|
|
tosync.each do |folders|
|
||||||
folders.each do |opts|
|
folders.each do |opts|
|
||||||
ssh_info = opts[:machine].ssh_info
|
ssh_info = opts[:machine].ssh_info
|
||||||
RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
|
begin
|
||||||
|
RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
|
||||||
|
rescue Vagrant::Errors::MachineGuestNotReady
|
||||||
|
# Error communicating to the machine, probably a reload or
|
||||||
|
# halt is happening. Just notify the user but don't fail out.
|
||||||
|
opts[:machine].ui.error(I18n.t(
|
||||||
|
"vagrant.rsync_communicator_not_ready_callback"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,6 +159,10 @@ en:
|
||||||
rsync_communicator_not_ready: |-
|
rsync_communicator_not_ready: |-
|
||||||
The machine is reporting that it is not ready for rsync to
|
The machine is reporting that it is not ready for rsync to
|
||||||
communiate with it. Verify that this machine is properly running.
|
communiate with it. Verify that this machine is properly running.
|
||||||
|
rsync_communicator_not_ready_callback: |-
|
||||||
|
Failed to connect to remote machine. This is usually caused by the
|
||||||
|
machine rebooting or being halted. Please make sure the machine is
|
||||||
|
running, and modify a file to try again.
|
||||||
rsync_folder: |-
|
rsync_folder: |-
|
||||||
Rsyncing folder: %{hostpath} => %{guestpath}
|
Rsyncing folder: %{hostpath} => %{guestpath}
|
||||||
rsync_folder_excludes: " - Exclude: %{excludes}"
|
rsync_folder_excludes: " - Exclude: %{excludes}"
|
||||||
|
|
|
@ -30,6 +30,9 @@ describe VagrantPlugins::SyncedFolderRSync::Command::RsyncAuto do
|
||||||
def machine_stub(name)
|
def machine_stub(name)
|
||||||
double(name).tap do |m|
|
double(name).tap do |m|
|
||||||
m.stub(ssh_info: ssh_info)
|
m.stub(ssh_info: ssh_info)
|
||||||
|
m.stub(ui: double("ui"))
|
||||||
|
|
||||||
|
m.ui.stub(error: nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,5 +98,27 @@ describe VagrantPlugins::SyncedFolderRSync::Command::RsyncAuto do
|
||||||
r = ["/foo/bar"]
|
r = ["/foo/bar"]
|
||||||
subject.callback(paths, m, a, r)
|
subject.callback(paths, m, a, r)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't fail if guest error occurs" do
|
||||||
|
paths["/foo"] = [
|
||||||
|
{ machine: machine_stub("m1"), opts: double("opts_m1") },
|
||||||
|
{ machine: machine_stub("m2"), opts: double("opts_m2") },
|
||||||
|
]
|
||||||
|
paths["/bar"] = [
|
||||||
|
{ machine: machine_stub("m3"), opts: double("opts_m3") },
|
||||||
|
]
|
||||||
|
|
||||||
|
paths["/foo"].each do |data|
|
||||||
|
expect(helper_class).to receive(:rsync_single).
|
||||||
|
with(data[:machine], data[:machine].ssh_info, data[:opts]).
|
||||||
|
and_raise(Vagrant::Errors::MachineGuestNotReady)
|
||||||
|
end
|
||||||
|
|
||||||
|
m = []
|
||||||
|
a = []
|
||||||
|
r = ["/foo/bar"]
|
||||||
|
expect { subject.callback(paths, m, a, r) }.
|
||||||
|
to_not raise_error
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue