Merge pull request #10690 from briancain/cleanup-rsync-tmp-folders
Cleanup rsync tmp folders
This commit is contained in:
commit
1592c0c216
|
@ -1,3 +1,4 @@
|
|||
require "fileutils"
|
||||
require "ipaddr"
|
||||
require "shellwords"
|
||||
require "tmpdir"
|
||||
|
@ -232,6 +233,8 @@ module VagrantPlugins
|
|||
message: err.to_s
|
||||
end
|
||||
end
|
||||
ensure
|
||||
FileUtils.remove_entry_secure(controlpath, true) if controlpath
|
||||
end
|
||||
|
||||
# Check if rsync versions support using chown option
|
||||
|
|
|
@ -292,6 +292,20 @@ 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", true).and_return(true)
|
||||
subject.rsync_single(machine, ssh_info, opts)
|
||||
end
|
||||
|
||||
it "does not create tmp dir on windows platforms" do
|
||||
allow(Vagrant::Util::Platform).to receive(:windows?).and_return(true)
|
||||
allow(Dir).to receive(:mktmpdir).with("vagrant-rsync-").
|
||||
and_return("/tmp/vagrant-rsync-12345")
|
||||
|
||||
expect(Vagrant::Util::Subprocess).to receive(:execute).with(any_args) { |*args|
|
||||
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", true)
|
||||
subject.rsync_single(machine, ssh_info, opts)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue