Skip to content

Commit

Permalink
Don't stamp redundant permissions onto child directories
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeiser committed Mar 16, 2012
1 parent 4643b54 commit 683a9e6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions chef/lib/chef/provider/remote_directory.rb
Expand Up @@ -131,10 +131,14 @@ def resource_for_directory(path)
dir = Chef::Resource::Directory.new(path, run_context)
dir.cookbook_name = @new_resource.cookbook || @new_resource.cookbook_name
if Chef::Platform.windows? && @new_resource.rights
@new_resource.rights.each do |rights| #rights is a hash
permissions = rights.delete(:permission) #delete will return the value or nil if not found
principal = rights.delete(:principal)
dir.rights(permissions, principal, rights)
# rights are only meant to be applied to the toppest-level directory;
# Windows will handle inheritance.
if path == @new_resource.path
@new_resource.rights.each do |rights| #rights is a hash
permissions = rights.delete(:permissions) #delete will return the value or nil if not found
principals = rights.delete(:principals)
dir.rights(permissions, principals, rights)
end
end
end
dir.mode(@new_resource.mode) if @new_resource.mode
Expand Down

0 comments on commit 683a9e6

Please sign in to comment.