summaryrefslogtreecommitdiff
path: root/lib/chef/provider/link.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-06-24 15:56:49 -0700
committerdanielsdeleo <dan@opscode.com>2013-06-25 19:56:09 -0700
commit283ab69016cb7e485ffaee0836ca486144d4de94 (patch)
treeb1982a52dc95550c621c98066ac64d1b0ed73871 /lib/chef/provider/link.rb
parent097fb215db74e9ae938f34531baf655e8a7b1576 (diff)
downloadchef-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/link.rb')
-rw-r--r--lib/chef/provider/link.rb11
1 files changed, 9 insertions, 2 deletions
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