diff options
Diffstat (limited to 'lib/chef/chef_fs/file_system.rb')
-rw-r--r-- | lib/chef/chef_fs/file_system.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb index 2b553b19a7..69dce54f00 100644 --- a/lib/chef/chef_fs/file_system.rb +++ b/lib/chef/chef_fs/file_system.rb @@ -52,13 +52,13 @@ class Chef def list_from(entry, &block) # Include self in results if it matches - if pattern.match?(entry.path) + if pattern.match?(entry.display_path) yield(entry) end - if pattern.could_match_children?(entry.path) + if pattern.could_match_children?(entry.display_path) # If it's possible that our children could match, descend in and add matches. - exact_child_name = pattern.exact_child_name_under(entry.path) + exact_child_name = pattern.exact_child_name_under(entry.display_path) # If we've got an exact name, don't bother listing children; just grab the # child with the given name. @@ -186,16 +186,16 @@ class Chef # Make sure everything on the server is also on the filesystem, and diff found_paths = Set.new Chef::ChefFS::FileSystem.list(a_root, pattern).each do |a| - found_paths << a.path - b = Chef::ChefFS::FileSystem.resolve_path(b_root, a.path) + found_paths << a.display_path + b = Chef::ChefFS::FileSystem.resolve_path(b_root, a.display_path) yield [ a, b ] end # Check the outer regex pattern to see if it matches anything on the # filesystem that isn't on the server Chef::ChefFS::FileSystem.list(b_root, pattern).each do |b| - if !found_paths.include?(b.path) - a = Chef::ChefFS::FileSystem.resolve_path(a_root, b.path) + if !found_paths.include?(b.display_path) + a = Chef::ChefFS::FileSystem.resolve_path(a_root, b.display_path) yield [ a, b ] end end @@ -222,14 +222,14 @@ class Chef result = [] a_children_names = Set.new a.children.each do |a_child| - a_children_names << a_child.name - result << [ a_child, b.child(a_child.name) ] + a_children_names << a_child.bare_name + result << [ a_child, b.child(a_child.bare_name) ] end # Check b for children that aren't in a b.children.each do |b_child| - if !a_children_names.include?(b_child.name) - result << [ a.child(b_child.name), b_child ] + if !a_children_names.include?(b_child.bare_name) + result << [ a.child(b_child.bare_name), b_child ] end end result @@ -327,8 +327,8 @@ class Chef if options[:dry_run] ui.output "Would create #{dest_path}" if ui else - new_dest_parent.create_child(src_entry.name, src_entry.read) - ui.output "Created #{dest_path}" if ui + child = new_dest_parent.create_child(src_entry.name, src_entry.read) + ui.output "Created #{format_path.call(child)}" if ui end end end @@ -392,6 +392,8 @@ class Chef end end end + rescue RubyFileError => e + ui.warn "#{format_path.call(e.entry)} #{e.reason}." if ui rescue DefaultEnvironmentCannotBeModifiedError => e ui.warn "#{format_path.call(e.entry)} #{e.reason}." if ui rescue OperationFailedError => e |