[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Nick Lewis nick at puppetlabs.com
Tue May 10 08:11:47 UTC 2011


The following commit has been merged in the experimental branch:
commit 9490cc9ecba28360c58173ec2eeb0dd1d3198960
Author: Nick Lewis <nick at puppetlabs.com>
Date:   Fri Apr 8 12:17:10 2011 -0700

    (#7026) Remove whits from reports when finalizing
    
    Resource statuses and metrics for Whits were being added to reports. Since they
    are transient internal data, they shouldn't be included in the report. This
    change adds a Puppet::Transaction::Report#prune_internal_data method, called by
    Puppet::Transaction::Report#finalize_report, providing a central place for this
    sort of pruning in the future.
    
    Paired-With: Max Martin

diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 16fee42..652b387 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -53,7 +53,13 @@ class Puppet::Transaction::Report
     end
   end
 
+  def prune_internal_data
+    resource_statuses.delete_if {|name,res| res.resource_type == 'Whit'}
+  end
+
   def finalize_report
+    prune_internal_data
+
     resource_metrics = add_metric(:resources, calculate_resource_metrics)
     add_metric(:time, calculate_time_metrics)
     change_metric = calculate_change_metric
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb
index a3bfe1e..e7bfce4 100755
--- a/spec/unit/transaction/report_spec.rb
+++ b/spec/unit/transaction/report_spec.rb
@@ -5,6 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
 require 'puppet/transaction/report'
 
 describe Puppet::Transaction::Report do
+  include PuppetSpec::Files
   before do
     Puppet::Util::Storage.stubs(:store)
   end
@@ -38,6 +39,24 @@ describe Puppet::Transaction::Report do
     report.configuration_version.should == "some version"
   end
 
+  it "should not include whits" do
+    Puppet::FileBucket::File.indirection.stubs(:save)
+
+    filename = tmpfile('whit_test')
+    file = Puppet::Type.type(:file).new(:path => filename)
+
+    catalog = Puppet::Resource::Catalog.new
+    catalog.add_resource(file)
+
+    report = Puppet::Transaction::Report.new("apply")
+
+    catalog.apply(:report => report)
+    report.finalize_report
+
+    report.resource_statuses.values.any? {|res| res.resource_type =~ /whit/i}.should be_false
+    report.metrics['time'].values.any? {|metric| metric.first =~ /whit/i}.should be_false
+  end
+
   describe "when accepting logs" do
     before do
       @report = Puppet::Transaction::Report.new("apply")

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list