summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-02-14 17:58:22 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2018-02-15 11:56:02 -0800
commitf85139b41ab6e9d24621e97bf71a3153d35147bc (patch)
tree28f8c9810fa96d4864bbe2196d2765fdb13b264c
parent72e167a8eb50887c040857fb04e00421bbab84ef (diff)
downloadchef-lcg/chef-13-attr-on-chef-12.tar.gz
make reset deferring nestlcg/chef-13-attr-on-chef-12
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/node/attribute.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb
index 17d16f64c2..4574572cfc 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -192,6 +192,8 @@ class Chef
@__node__ = node
node.attributes = self
+ @disable_cache_reset = false
+
defer_cache_resetting do
@default = VividMash.new({}, self, node, :default)
@env_default = VividMash.new({}, self, node, :env_default)
@@ -251,10 +253,11 @@ class Chef
# avoid doing cache clearing work for an entire block of code, then nuke the entire cache
# @api private
def defer_cache_resetting
+ saved = @disable_cache_reset
@disable_cache_reset = true
yield
- @disable_cache_reset = false
- reset
+ @disable_cache_reset = saved
+ reset_cache
end
# @api private