diff options
author | danielsdeleo <dan@opscode.com> | 2013-06-24 15:56:49 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-06-25 19:56:09 -0700 |
commit | 283ab69016cb7e485ffaee0836ca486144d4de94 (patch) | |
tree | b1982a52dc95550c621c98066ac64d1b0ed73871 /lib/chef/provider | |
parent | 097fb215db74e9ae938f34531baf655e8a7b1576 (diff) | |
download | chef-283ab69016cb7e485ffaee0836ca486144d4de94.tar.gz |
Determine if ACL mgmt follows symlinks by provider type.
- Prerequisite for CHEF-4312 fix.
- File access control defers to the provider to determine whether to use
link-following system calls or not (e.g., chmod vs. lchmod). File
provider and subclasses will use link-following calls (chmod), Link
provider uses calls that manage the symlink itself (e.g., lchmod).
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/file.rb | 7 | ||||
-rw-r--r-- | lib/chef/provider/link.rb | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb index 9e6e1dc3e0..52c0da7a72 100644 --- a/lib/chef/provider/file.rb +++ b/lib/chef/provider/file.rb @@ -154,6 +154,13 @@ class Chef end end + # Implementation components *should* follow symlinks when managing access + # control (e.g., use chmod instead of lchmod even if the path we're + # managing is a symlink). + def manage_symlink_access? + false + end + private def content diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb index 5a29aff623..7776b59a85 100644 --- a/lib/chef/provider/link.rb +++ b/lib/chef/provider/link.rb @@ -116,17 +116,24 @@ class Chef access_controls.set_all end end - end + end end def action_delete if @current_resource.to # Exists - converge_by ("delete link at #{@new_resource.target_file}") do + converge_by("delete link at #{@new_resource.target_file}") do ::File.delete(@new_resource.target_file) Chef::Log.info("#{@new_resource} deleted") end end end + + # Implementation components *should not* follow symlinks when managing + # access control (e.g., use lchmod instead of chmod) if the resource is a + # symlink. + def manage_symlink_access? + @new_resource.link_type == :symbolic + end end end end |