summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-09-14 21:08:50 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-09-14 21:08:50 -0700
commitaad00ac319040e0254a74afcfc2a8be8084fce47 (patch)
tree49427942f4e8b1810063698b42ca6f618031827d
parenta300e22d486df119b5588ca28d13f21e5cdb7353 (diff)
parent01bfabc9015f68af084d76a29ee46dc38285e535 (diff)
downloadchef-aad00ac319040e0254a74afcfc2a8be8084fce47.tar.gz
Merge pull request #3853 from chef/lcg/suppress_freeze_warnings
move warning to debug
-rw-r--r--lib/chef/resource.rb4
-rw-r--r--spec/integration/client/client_spec.rb2
-rw-r--r--spec/unit/property_spec.rb6
3 files changed, 0 insertions, 12 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index ee75dec3b9..aec78b4f6d 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -808,10 +808,6 @@ class Chef
property = property_type(**options)
end
- if !options[:default].frozen? && (options[:default].is_a?(Array) || options[:default].is_a?(Hash))
- Chef.log_deprecation("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
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 1a030c130b..5b235e2720 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -350,8 +350,6 @@ EOM
expect(run_complete).to be >= 0
# Make sure there is exactly one result for each, and that it occurs *after* the complete message.
- expect(match_indices(/MyResource.x has an array or hash default/, result.stdout)).to match([ be > run_complete ])
- expect(match_indices(/MyResource.y has an array or hash default/, result.stdout)).to match([ be > run_complete ])
expect(match_indices(/nil currently does not overwrite the value of/, result.stdout)).to match([ be > run_complete ])
end
end
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 50764aa7a2..f758b5f403 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -480,12 +480,6 @@ describe "Chef::Resource.property" do
end
end
- it "when a property is declared with default: {}, a warning is issued" do
- expect(Chef::Log).to receive(:deprecation).with( /^Property .+\.x has an array or hash 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 \{ \{\} \}\.$/, /property_spec\.rb/ )
- resource_class.class_eval("property :x, default: {}", __FILE__, __LINE__)
- expect(resource.x).to eq({})
- end
-
with_property ':x, default: lazy { {} }' do
it "when x is not set, it returns {}" do
expect(resource.x).to eq({})