]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/libraries/remote_directory.rb
Revert "Take thorn-03 out of production"
[chef.git] / cookbooks / chef / libraries / remote_directory.rb
index 32dacc5008edb362e791a1ad5bd0b2ed7bd13ff8..959eb29409445514cf376d133d26cdadfbb7e83c 100644 (file)
@@ -11,15 +11,16 @@ class Chef
           files_transferred << ::File.dirname(::File.join(@new_resource.path, cookbook_file_relative_path))
           files_transferred << ::File.join(@new_resource.path, cookbook_file_relative_path)
         end
-        if @new_resource.purge
-          files_to_purge = Set.new(
-                                   Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
-                                     name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
-                                   end
-                                   )
-          files_to_purge = files_to_purge - files_transferred
-          purge_unmanaged_files(files_to_purge)
-        end
+
+        return unless @new_resource.purge
+
+        files_to_purge = Set.new(
+          Dir.glob(::File.join(@new_resource.path, "**", "*"), ::File::FNM_DOTMATCH).select do |name|
+            name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
+          end
+        )
+        files_to_purge -= files_transferred
+        purge_unmanaged_files(files_to_purge)
       end
     end
   end