diff options
author | John Keiser <john@johnkeiser.com> | 2015-07-31 17:24:07 -0600 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-08-03 13:42:10 -0600 |
commit | fe6676bab51390429674b0ecd4670924ffb09cc5 (patch) | |
tree | 87a3f38d63663164ba3fab00365de873c9cd2a1b /lib/chef/resource.rb | |
parent | 0e3fda07d99269a35009673eafec573d0db52000 (diff) | |
download | chef-fe6676bab51390429674b0ecd4670924ffb09cc5.tar.gz |
Remove freeze of defaults, add warning for array/hash constant defaults
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r-- | lib/chef/resource.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index b9c074117f..60ec6bde93 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -808,6 +808,10 @@ class Chef property = property_type(**options) end + if !options[:default].frozen? && (options[:default].is_a?(Array) || options[:default].is_a?(Hash)) + Chef::Log.warn("Property #{self}.#{name} has an array or hash default (#{options[:default]}). This means that if one resource modifies or appends to it, all other resources of the same type will also see the changes. Either freeze the constant with `.freeze` to prevent appending, or use lazy { #{options[:default].inspect} }.") + end + local_properties = properties(false) local_properties[name] = property |