summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornimisha <nimisha.sharad@clogeny.com>2016-09-12 18:37:00 +0530
committernimisha <nimisha.sharad@clogeny.com>2016-09-16 14:02:51 +0530
commit98a41594e1e2fba8b6061fe794524a64998b243e (patch)
tree9305bb76f7ee882d64c7c40ca2d3ac98dfa38a22
parentf39bb63e7d09e590ef5036091beb37885d1cc391 (diff)
downloadchef-98a41594e1e2fba8b6061fe794524a64998b243e.tar.gz
Removed update_resource_count attribute and added supress_log_resource_count chef config
-rw-r--r--lib/chef/provider/log.rb2
-rw-r--r--lib/chef/resource/log.rb9
-rw-r--r--spec/unit/provider/log_spec.rb10
-rw-r--r--spec/unit/resource/log_spec.rb15
4 files changed, 6 insertions, 30 deletions
diff --git a/lib/chef/provider/log.rb b/lib/chef/provider/log.rb
index 2045918e27..d2eb956562 100644
--- a/lib/chef/provider/log.rb
+++ b/lib/chef/provider/log.rb
@@ -45,7 +45,7 @@ class Chef
# true:: Always return true
def action_write
Chef::Log.send(@new_resource.level, @new_resource.message)
- @new_resource.updated_by_last_action(true) if @new_resource.update_resource_count
+ @new_resource.updated_by_last_action(true) unless Chef::Config[:knife][:supress_log_resource_count]
end
end
diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb
index 56ab87f8d1..8f7879872f 100644
--- a/lib/chef/resource/log.rb
+++ b/lib/chef/resource/log.rb
@@ -52,7 +52,6 @@ class Chef
super
@level = :info
@message = name
- @update_resource_count = true
end
def message(arg = nil)
@@ -72,14 +71,6 @@ class Chef
)
end
- def update_resource_count(arg = nil)
- set_or_return(
- :update_resource_count,
- arg,
- :kind_of => [TrueClass, FalseClass]
- )
- end
-
end
end
end
diff --git a/spec/unit/provider/log_spec.rb b/spec/unit/provider/log_spec.rb
index 36d5ef54d4..fa4dce3e88 100644
--- a/spec/unit/provider/log_spec.rb
+++ b/spec/unit/provider/log_spec.rb
@@ -73,15 +73,15 @@ describe Chef::Provider::Log::ChefLog do
provider.run_action(:write)
end
- context "when update_resource_count attribute is passed" do
- it "updates the resource count if update_resource_count=true" do
- new_resource.update_resource_count true
+ context "when supress_log_resource_count is passed in knife.rb" do
+ it "updates the resource count if supress_log_resource_count=false" do
+ Chef::Config[:knife][:supress_log_resource_count] = false
expect(new_resource).to receive(:updated_by_last_action)
provider.run_action(:write)
end
- it "doesn't update the resource count if update_resource_count=false" do
- new_resource.update_resource_count false
+ it "doesn't update the resource count if supress_log_resource_count=true" do
+ Chef::Config[:knife][:supress_log_resource_count] = true
expect(new_resource).not_to receive(:updated_by_last_action)
provider.run_action(:write)
end
diff --git a/spec/unit/resource/log_spec.rb b/spec/unit/resource/log_spec.rb
index 2e5209e7c0..18a1eb65bf 100644
--- a/spec/unit/resource/log_spec.rb
+++ b/spec/unit/resource/log_spec.rb
@@ -70,19 +70,4 @@ describe Chef::Resource::Log do
expect(@resource.identity).to eq("ery day I'm loggin-in")
end
end
-
- context "update_resource_count attribute" do
- it "sets the default value of update_resource_count as true" do
- expect(@resource.update_resource_count).to eq(true)
- end
-
- it "accepts a boolean value for update_resource_count attribute" do
- @resource.update_resource_count false
- expect(@resource.update_resource_count).to eq(false)
- end
-
- it "raises error if a non-boolean value is passed for update_resource_count attribute" do
- expect { @resource.update_resource_count "abc" }.to raise_error(Chef::Exceptions::ValidationFailed)
- end
- end
end