summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-09-30 09:48:31 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-30 09:48:31 -0700
commitaa3157948cfab9ea6e4944f9fe7a6be285a2aaed (patch)
tree1a4bbd51b384894d3fc505413558b6b6a2063988
parenta423a9027580b64afcceab5c98b4835bd26d1d31 (diff)
downloadchef-aa3157948cfab9ea6e4944f9fe7a6be285a2aaed.tar.gz
Added comments about what remote_directory is doing
-rw-r--r--lib/chef/provider/remote_directory.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb
index 298231277f..874c6f8e1f 100644
--- a/lib/chef/provider/remote_directory.rb
+++ b/lib/chef/provider/remote_directory.rb
@@ -36,14 +36,16 @@ class Chef
def action_create
super
+ # Mark all files as needing to be purged
files_to_purge = Set.new(Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(@new_resource.path), '**', '*'),
::File::FNM_DOTMATCH).select do |name|
+ # Everything except current directory and previous directory
basename = Pathname.new(name).basename().to_s
['.', '..'].all? {|n| n != basename}
- end).map! {|i| Chef::Util::PathHelper.cleanpath(i)}
+ end).map! {|i| Chef::Util::PathHelper.cleanpath(i)} # Make sure each path is clean
files_to_transfer.each do |cookbook_file_relative_path|
create_cookbook_file(cookbook_file_relative_path)
- # parent directories are also removed from the purge list
+ # parent directories and file being transfered are removed from the purge list
Pathname.new(Chef::Util::PathHelper.cleanpath(::File.join(@new_resource.path, cookbook_file_relative_path))).descend do |d|
files_to_purge.delete(d.to_s)
end