summaryrefslogtreecommitdiff
path: root/lib/chef/provider/file.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-07-02 15:44:57 -0700
committerdanielsdeleo <dan@opscode.com>2013-07-02 19:04:02 -0700
commitc2407b4187f16747979956b90a6dc98f3997b01c (patch)
treee8c17f1147683eac995291486400f8accdb1dcd1 /lib/chef/provider/file.rb
parenta3565d9d674c777d9988bcbaa778862a02da5466 (diff)
downloadchef-c2407b4187f16747979956b90a6dc98f3997b01c.tar.gz
Use symlink source when inspecting current permissions
Fixes CHEF-4341 http://tickets.opscode.com/browse/CHEF-4341 When manage_symlink_source is enabled, File providers update current_resource with the security attributes of the source file. Subsequent actions (e.g., running FileAccessControl) use the values set on current_resource to determine if they need to modify the system, so setting them incorrect leads to a file resource being (not) updated incorrectly.
Diffstat (limited to 'lib/chef/provider/file.rb')
-rw-r--r--lib/chef/provider/file.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index 012073f674..e727aa9ec1 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -74,7 +74,7 @@ class Chef
# Let children resources override constructing the @current_resource
@current_resource ||= Chef::Resource::File.new(@new_resource.name)
@current_resource.path(@new_resource.path)
- if real_file?(@current_resource.path) && ::File.exists?(@current_resource.path)
+ if ::File.exists?(@current_resource.path) && ::File.file?(::File.realpath(@current_resource.path))
if @action != :create_if_missing && @current_resource.respond_to?(:checksum)
@current_resource.checksum(checksum(@current_resource.path))
end
@@ -292,6 +292,7 @@ class Chef
converge_by(description) do
unlink(@new_resource.path)
end
+ @current_resource.checksum = nil
@file_unlinked = true
end
end