summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-09-04 15:00:45 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-09-08 15:31:32 -0700
commiteca40ce0ac96a58f939c470d0fea3d51e6ce4681 (patch)
treec115f6ed964c46c8a29cb3da8a72b2d2cefc34d7
parent285f5d8fd84cc661573963b60795459a12fff339 (diff)
downloadchef-eca40ce0ac96a58f939c470d0fea3d51e6ce4681.tar.gz
invalidate regular_writer
this is also a mutator method on the vivid_mash which is called when we autovivize, so this fixes the busted autovivize spec
-rw-r--r--lib/chef/node/attribute_trait/deep_merge_cache.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/chef/node/attribute_trait/deep_merge_cache.rb b/lib/chef/node/attribute_trait/deep_merge_cache.rb
index 49a2b7519e..b02adb2455 100644
--- a/lib/chef/node/attribute_trait/deep_merge_cache.rb
+++ b/lib/chef/node/attribute_trait/deep_merge_cache.rb
@@ -66,6 +66,16 @@ class Chef
end
end
+ def regular_writer(*path, value)
+ if is_a?(Chef::Node::VividMash)
+ cache = __deep_merge_cache.regular_reader(*__path, *path) rescue nil
+ if cache && cache.key?(:__deep_merge_cache)
+ cache.delete(:__deep_merge_cache)
+ end
+ end
+ super
+ end
+
def [](key)
if is_a?(Chef::Node::Attribute)
cache_val = __deep_merge_cache.regular_reader(*__path, key, :__deep_merge_cache) rescue nil