summaryrefslogtreecommitdiff
path: root/lib/chef/node
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-07-08 10:40:38 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-07-08 10:40:38 -0700
commit48304f2dc87cc4dc184d73133453e2dbf64c0e2b (patch)
tree5c26b774a86641487867e79f090dc7a54496d10e /lib/chef/node
parentdfe3498c68da48362b6bf8d558ecd3386702cd45 (diff)
downloadchef-48304f2dc87cc4dc184d73133453e2dbf64c0e2b.tar.gz
fix for #5094 12.12.13 node.default_unless issue
note that the node_spec test in this commit is not red on master so it ain't testing the right thing yet, but this fixes the issue in chef-shell...
Diffstat (limited to 'lib/chef/node')
-rw-r--r--lib/chef/node/common_api.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chef/node/common_api.rb b/lib/chef/node/common_api.rb
index 6f921e15aa..ce2c6b6878 100644
--- a/lib/chef/node/common_api.rb
+++ b/lib/chef/node/common_api.rb
@@ -32,6 +32,7 @@ class Chef
# - autovivifying / autoreplacing writer
# - non-container-ey intermediate objects are replaced with hashes
def write(*args, &block)
+ root.top_level_breadcrumb = nil if respond_to?(:root)
value = block_given? ? yield : args.pop
last = args.pop
prev_memo = prev_key = nil
@@ -55,6 +56,7 @@ class Chef
# something that is not a container ("schema violation" issues).
#
def write!(*args, &block)
+ root.top_level_breadcrumb = nil if respond_to?(:root)
value = block_given? ? yield : args.pop
last = args.pop
obj = args.inject(self) do |memo, key|
@@ -69,6 +71,7 @@ class Chef
# return true or false based on if the attribute exists
def exist?(*path)
+ root.top_level_breadcrumb = nil if respond_to?(:root)
path.inject(self) do |memo, key|
return false unless valid_container?(memo, key)
if memo.is_a?(Hash)
@@ -100,6 +103,7 @@ class Chef
# non-autovivifying reader that throws an exception if the attribute does not exist
def read!(*path)
raise Chef::Exceptions::NoSuchAttribute unless exist?(*path)
+ root.top_level_breadcrumb = nil if respond_to?(:root)
path.inject(self) do |memo, key|
memo[key]
end
@@ -108,6 +112,7 @@ class Chef
# FIXME:(?) does anyone really like the autovivifying reader that we have and wants the same behavior? readers that write? ugh...
def unlink(*path, last)
+ root.top_level_breadcrumb = nil if respond_to?(:root)
hash = path.empty? ? self : read(*path)
return nil unless hash.is_a?(Hash) || hash.is_a?(Array)
root.top_level_breadcrumb ||= last