commands/rsync-auto: check machine ID prior to sync [GH-4031]
This commit is contained in:
parent
7f5f720e0a
commit
a08d9078da
|
@ -26,6 +26,7 @@ BUG FIXES:
|
||||||
but this fixes a few. [GH-4159]
|
but this fixes a few. [GH-4159]
|
||||||
- core: Fix crash case when destroying with an invalid provisioner. [GH-4281]
|
- core: Fix crash case when destroying with an invalid provisioner. [GH-4281]
|
||||||
- commands/package: base package won't crash with exception [GH-4017]
|
- commands/package: base package won't crash with exception [GH-4017]
|
||||||
|
- commands/rsync-auto: Destroyed machines won't raise exceptions. [GH-4031]
|
||||||
- communicators/winrm: Support `mkdir` [GH-4271]
|
- communicators/winrm: Support `mkdir` [GH-4271]
|
||||||
- guests/centos: Fix issues when NFS client is installed by restarting
|
- guests/centos: Fix issues when NFS client is installed by restarting
|
||||||
NFS [GH-4088]
|
NFS [GH-4088]
|
||||||
|
|
|
@ -156,6 +156,13 @@ module VagrantPlugins
|
||||||
# Sync all the folders that need to be synced
|
# Sync all the folders that need to be synced
|
||||||
tosync.each do |folders|
|
tosync.each do |folders|
|
||||||
folders.each do |opts|
|
folders.each do |opts|
|
||||||
|
# Reload so we get the latest ID
|
||||||
|
opts[:machine].reload
|
||||||
|
if !opts[:machine].id || opts[:machine].id == ""
|
||||||
|
# Skip since we can't get SSH info without an ID
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
ssh_info = opts[:machine].ssh_info
|
ssh_info = opts[:machine].ssh_info
|
||||||
begin
|
begin
|
||||||
RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
|
RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
|
||||||
|
|
|
@ -29,6 +29,8 @@ 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(id: "foo")
|
||||||
|
m.stub(reload: nil)
|
||||||
m.stub(ssh_info: ssh_info)
|
m.stub(ssh_info: ssh_info)
|
||||||
m.stub(ui: double("ui"))
|
m.stub(ui: double("ui"))
|
||||||
|
|
||||||
|
@ -120,5 +122,22 @@ describe VagrantPlugins::SyncedFolderRSync::Command::RsyncAuto do
|
||||||
expect { subject.callback(paths, m, a, r) }.
|
expect { subject.callback(paths, m, a, r) }.
|
||||||
to_not raise_error
|
to_not raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't sync machines with no ID" do
|
||||||
|
paths["/foo"] = [
|
||||||
|
{ machine: machine_stub("m1"), opts: double("opts_m1") },
|
||||||
|
]
|
||||||
|
|
||||||
|
paths["/foo"].each do |data|
|
||||||
|
data[:machine].stub(id: nil)
|
||||||
|
expect(helper_class).to_not receive(:rsync_single)
|
||||||
|
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