summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-12-16 16:23:34 -0800
committerPaul Berry <paul@puppetlabs.com>2010-12-17 11:02:12 -0800
commit4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b (patch)
treee62d0db3e04e0c3ebbfd806cc9966ac67ab0eff9 /lib/puppet
parent7fff7808e25491a5ea1e207b8de3ade0c4f95f4f (diff)
downloadpuppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.tar.gz
puppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.tar.xz
puppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.zip
Modified the behavior of Puppet::Resource::Status as follows:
- #change_count now only counts events that represent successful changes. It does not count failures, audits, or noops. - #changed is equivalent to #change_count > 0. - #out_of_sync_count (a new attribute) counts all events except audits. - #out_of_sync is equivalent to #out_of_sync_count > 0. This should hopefully make the summary statistics in reports more useful.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/resource/status.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/puppet/resource/status.rb b/lib/puppet/resource/status.rb
index 9240a06d7..f34edc469 100644
--- a/lib/puppet/resource/status.rb
+++ b/lib/puppet/resource/status.rb
@@ -10,7 +10,7 @@ module Puppet
attr_accessor *STATES
attr_reader :source_description, :default_log_level, :time, :resource
- attr_reader :change_count
+ attr_reader :change_count, :out_of_sync_count
# Provide a boolean method for each of the states.
STATES.each do |attr|
@@ -28,10 +28,14 @@ module Puppet
@events << event
if event.status == 'failure'
self.failed = true
+ elsif event.status == 'success'
+ @change_count += 1
+ @changed = true
+ end
+ if event.status != 'audit'
+ @out_of_sync_count += 1
+ @out_of_sync = true
end
- @change_count += 1
- @changed = true
- @out_of_sync = true
end
def events
@@ -42,6 +46,7 @@ module Puppet
@source_description = resource.path
@resource = resource.to_s
@change_count = 0
+ @out_of_sync_count = 0
[:file, :line, :version].each do |attr|
send(attr.to_s + "=", resource.send(attr))