From 3b540e502feb6576770ae6bbb4358e6f165cd57a Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Tue, 26 Feb 2019 09:08:56 -0800 Subject: [PATCH] Force removal of rsync tmp dir Force delete entry to prevent any potentail failures when trying to clean up the tmp dir from rsync --- plugins/synced_folders/rsync/helper.rb | 2 +- test/unit/plugins/synced_folders/rsync/helper_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/synced_folders/rsync/helper.rb b/plugins/synced_folders/rsync/helper.rb index b93f85a2a..c23cd1d53 100644 --- a/plugins/synced_folders/rsync/helper.rb +++ b/plugins/synced_folders/rsync/helper.rb @@ -234,7 +234,7 @@ module VagrantPlugins end end ensure - FileUtils.remove_entry_secure(controlpath) if controlpath + FileUtils.remove_entry_secure(controlpath, true) if controlpath end # Check if rsync versions support using chown option diff --git a/test/unit/plugins/synced_folders/rsync/helper_test.rb b/test/unit/plugins/synced_folders/rsync/helper_test.rb index 860ea0403..e50ae872c 100644 --- a/test/unit/plugins/synced_folders/rsync/helper_test.rb +++ b/test/unit/plugins/synced_folders/rsync/helper_test.rb @@ -292,7 +292,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do expect(args[9]).to include("ControlPath=/tmp/vagrant-rsync-12345") }.and_return(result) - expect(FileUtils).to receive(:remove_entry_secure).with("/tmp/vagrant-rsync-12345").and_return(true) + expect(FileUtils).to receive(:remove_entry_secure).with("/tmp/vagrant-rsync-12345", true).and_return(true) subject.rsync_single(machine, ssh_info, opts) end @@ -305,7 +305,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do expect(args).not_to include("ControlPath=/tmp/vagrant-rsync-12345") }.and_return(result) - expect(FileUtils).not_to receive(:remove_entry_secure).with("/tmp/vagrant-rsync-12345") + expect(FileUtils).not_to receive(:remove_entry_secure).with("/tmp/vagrant-rsync-12345", true) subject.rsync_single(machine, ssh_info, opts) end end