summaryrefslogtreecommitdiff
path: root/lib/chef/node/attribute_collections.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-12-14 16:17:22 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2015-12-14 16:17:22 -0800
commit5d16e1847ad20818651af2b39c08285d94772e69 (patch)
treef48c2d62d58c100b49f057feae3f16f63b530e1d /lib/chef/node/attribute_collections.rb
parent7814a405d629b612cd0b93266db79e2427f59d7d (diff)
downloadchef-5d16e1847ad20818651af2b39c08285d94772e69.tar.gz
tags always an array; fix set_unless
previously if the node had a { normal: { tags: nil } } that we read since the key existed (but was nil) we would not initialize with an array. replacing the code with a call to node.set_unless revealed that set_unless was similarly buggy. fixed both issues by fixing set_unless.
Diffstat (limited to 'lib/chef/node/attribute_collections.rb')
-rw-r--r--lib/chef/node/attribute_collections.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb
index b912904534..1dcc950c6e 100644
--- a/lib/chef/node/attribute_collections.rb
+++ b/lib/chef/node/attribute_collections.rb
@@ -1,6 +1,6 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -148,7 +148,7 @@ class Chef
def []=(key, value)
root.top_level_breadcrumb ||= key
- if set_unless? && key?(key)
+ if set_unless? && key?(key) && !self[key].nil?
self[key]
else
root.reset_cache(root.top_level_breadcrumb)