summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2015-06-09 10:28:25 +0100
committerThom May <thom@may.lt>2015-06-09 10:28:25 +0100
commit6daea43f5578d6bf2aeb3464144dd8dbdf6bd4ef (patch)
treeb3ff28173e0cf06bc99f90f74e278a2caf09bca9 /lib
parent6b4d242607440a5e9193aa3dd02e986ab2691e83 (diff)
parenta93cdc6e526735912eae6f921f1da2af8b0ef5b0 (diff)
downloadchef-6daea43f5578d6bf2aeb3464144dd8dbdf6bd4ef.tar.gz
Merge pull request #3497 from chef/adamedx/3485-run_context_corruption
Issue#3485: Fix corruption of run_context when guard interpreters are executed
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/guard_interpreter/resource_guard_interpreter.rb5
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