]> git.openstreetmap.org Git - chef.git/blob - cookbooks/chef/libraries/remote_directory.rb
Remove bogus row limit from chef server status view
[chef.git] / cookbooks / chef / libraries / remote_directory.rb
1 class Chef
2   class Provider
3     class RemoteDirectory
4       def action_create
5         super
6         Chef::Log.debug("Doing a remote recursive directory transfer for #{@new_resource}")
7           
8         files_transferred = Set.new
9         files_to_transfer.each do |cookbook_file_relative_path|
10           create_cookbook_file(cookbook_file_relative_path)
11           files_transferred << ::File.dirname(::File.join(@new_resource.path, cookbook_file_relative_path))
12           files_transferred << ::File.join(@new_resource.path, cookbook_file_relative_path)
13         end
14         if @new_resource.purge
15           files_to_purge = Set.new(
16                                    Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
17                                      name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
18                                    end
19                                    )
20           files_to_purge = files_to_purge - files_transferred
21           purge_unmanaged_files(files_to_purge)
22         end
23       end
24     end
25   end
26 end