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-21 14:32:18 -0800
commitceea0382b453153e6e96be8c9e7ba63c57494142 (patch)
treeb5038aaed0aa227b9133b5b450cdd5d0bb923892
parent43a8be38b5b3838863eb7fdac2f0528ceb0a9912 (diff)
downloadchef-lcg/de-lazy-attributes.tar.gz
make reset deferring nestlcg/de-lazy-attributes
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 15ff2b5df0..2e432b583f 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -190,6 +190,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)
@@ -245,10 +247,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