summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-09-01 10:11:52 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-09-01 10:11:52 -0700
commit6c8f6d834c30216aa8d566345c96ae62520013e8 (patch)
tree393cdb7887412c8ec6ceb4623ee9914c7f643062
parentc0de99517f8912537a5e61db4964dab81a326c39 (diff)
downloadchef-6c8f6d834c30216aa8d566345c96ae62520013e8.tar.gz
more warning to debug
1. the deploy resource and other internal chef resources trigger this. 2. this is largely a non-problem since people have been happily using the deploy resource for years and nobody has showed up in any of our bugtrackers due to mutating the default hash. we simply don't need to annoy people this badly over this.
-rw-r--r--lib/chef/resource.rb2
-rw-r--r--spec/unit/property_spec.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 5bef40625f..8b248877e3 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -809,7 +809,7 @@ class Chef
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} }.")
+ Chef::Log.debug("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)
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 55eaead9ba..b2e9e2acde 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -476,8 +476,8 @@ 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(:warn).with(match(/^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 \{ \{\} \}\.$/))
+ it "when a property is declared with default: {}, a debug level warning is issued" do
+ expect(Chef::Log).to receive(:debug).with(match(/^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 \{ \{\} \}\.$/))
resource_class.class_eval("property :x, default: {}", __FILE__, __LINE__)
expect(resource.x).to eq({})
end