diff options
author | adamedx <adamed@getchef.com> | 2015-06-03 17:31:50 -0700 |
---|---|---|
committer | adamedx <adamed@getchef.com> | 2015-06-06 08:36:31 -0700 |
commit | a93cdc6e526735912eae6f921f1da2af8b0ef5b0 (patch) | |
tree | 572b289a770cc740cf82e6a023aa7fa5c3e6230b /lib | |
parent | fd18d4bdfd79a269a3220936efd2ec8f69353c29 (diff) | |
download | chef-a93cdc6e526735912eae6f921f1da2af8b0ef5b0.tar.gz |
Issue#3485: Fix corruption of run_context when guard interpreters are executedadamedx/3485-run_context_corruption
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/guard_interpreter/resource_guard_interpreter.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/chef/guard_interpreter/resource_guard_interpreter.rb b/lib/chef/guard_interpreter/resource_guard_interpreter.rb index 1e2a534c18..d4b386a15a 100644 --- a/lib/chef/guard_interpreter/resource_guard_interpreter.rb +++ b/lib/chef/guard_interpreter/resource_guard_interpreter.rb @@ -92,8 +92,11 @@ class Chef raise ArgumentError, "Specified guard interpreter class #{resource_class} must be a kind of Chef::Resource::Execute resource" end + # Duplicate the node below because the new RunContext + # overwrites the state of Node instances passed to it. + # See https://github.com/chef/chef/issues/3485. empty_events = Chef::EventDispatch::Dispatcher.new - anonymous_run_context = Chef::RunContext.new(parent_resource.node, {}, empty_events) + anonymous_run_context = Chef::RunContext.new(parent_resource.node.dup, {}, empty_events) interpreter_resource = resource_class.new('Guard resource', anonymous_run_context) interpreter_resource.is_guard_interpreter = true |