summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-04-28 15:44:23 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-05-01 11:09:49 -0700
commit4100e8e9b75e1175b8efee04913ab6fb045bd3e8 (patch)
treec473b2f173f24b192d2d38e7da300a86478312c7
parent614a1367376bb92b8293f8bbffc87c21e574470e (diff)
downloadchef-4100e8e9b75e1175b8efee04913ab6fb045bd3e8.tar.gz
don't mutate the new resource
this line violates the rule that we never mutate the new resource. in Chef 12 this causes real problems because if a file resource is notified (run twice) then the rendered content is loaded into the new resource and if the file resource content changes (i.e. its a template with logic which changes when its notified) then it will cause a failure because the rendered content will not match the 'requested' checksum. where the 'requested' checksum is actually the checksum loaded by this line. fundamentally we have three different states that we're trying to track: - current state - initial state - requested state the removed line tries to use the @new_resource for reporting initial state, which then bleeds over into what chef thinks is requested state in the next invokation. without constructing a third @initial_resource and using that for resource reporting comparison we can't solve this problem "right". the tradeoff is we either break reporting here or break chef-client runs. this patch sacrifices reporting in order to make chef-client work.
-rw-r--r--lib/chef/provider/file.rb3
1 files changed, 0 insertions, 3 deletions
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index c070d29458..44ee91a079 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -388,9 +388,6 @@ class Chef
do_backup unless needs_creating?
deployment_strategy.deploy(tempfile.path, ::File.realpath(@new_resource.path))
Chef::Log.info("#{@new_resource} updated file contents #{@new_resource.path}")
- if managing_content?
- @new_resource.checksum(checksum(@new_resource.path)) # for reporting
- end
end
def do_contents_changes