Allow file provisioner to copy empty folders
This commit is contained in:
parent
16ef520d9d
commit
187d8e9cfd
@ -307,10 +307,11 @@ module VagrantPlugins
|
||||
scp_connect do |scp|
|
||||
uploader = lambda do |path, remote_dest=nil|
|
||||
if File.directory?(path)
|
||||
dest = File.join(to, path.sub(/^#{Regexp.escape(from)}/, ""))
|
||||
create_remote_directory(dest)
|
||||
Dir.new(path).each do |entry|
|
||||
next if entry == "." || entry == ".."
|
||||
full_path = File.join(path, entry)
|
||||
dest = File.join(to, path.sub(/^#{Regexp.escape(from)}/, ""))
|
||||
create_remote_directory(dest)
|
||||
uploader.call(full_path, dest)
|
||||
end
|
||||
|
||||
@ -565,6 +565,16 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
it "creates remote directory given an empty directory" do
|
||||
file = Dir.mktmpdir
|
||||
begin
|
||||
expect(communicator).to receive(:create_remote_directory).with("/destination/dir/#{ File.basename(file)}/")
|
||||
communicator.upload(file, "/destination/dir")
|
||||
ensure
|
||||
FileUtils.rm_rf(file)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises custom error on permission errors" do
|
||||
file = Tempfile.new('vagrant-test')
|
||||
begin
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user