[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:30:48 UTC 2010


The following commit has been merged in the upstream branch:
commit 242209d251c7807378d3af6d9bffbc9ed59be723
Author: Luke Kanies <luke at madstop.com>
Date:   Wed Nov 4 17:23:38 2009 -0500

    Correcting comments and making report timestamp internal
    
    We had some no-longer-correct comments in the Transaction
    class, which are now removed.  This also moves the timestamp
    for reports into the report class, so it's created at
    initialization by the report, rather than by the transaction.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index aee541f..7e478ab 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -58,8 +58,7 @@ class Puppet::Transaction
         end
     end
 
-    # Apply all changes for a resource, returning a list of the events
-    # generated.
+    # Apply all changes for a resource
     def apply(resource)
         begin
             changes = resource.evaluate
@@ -191,11 +190,6 @@ class Puppet::Transaction
             end
         end
 
-        # A bit of hackery here -- if skipcheck is true, then we're the
-        # top-level resource.  If that's the case, then make sure all of
-        # the changes list this resource as a proxy.  This is really only
-        # necessary for rollback, since we know the generating resource
-        # during forward changes.
         unless children.empty?
             @changes[changecount..-1].each { |change| change.proxy = resource }
         end
@@ -326,8 +320,7 @@ class Puppet::Transaction
 
         # Then all of the change-related metrics
         report.newmetric(:changes, :total => @changes.length)
-
-        report.time = Time.now
+        return report
     end
 
     # Should we ignore tags?
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 45a249f..5a0332f 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -28,6 +28,7 @@ class Puppet::Transaction::Report
         @logs = []
         @events = []
         @host = Puppet[:certname]
+        @time = Time.now
     end
 
     def name
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index 3adecf6..a4d6b1e 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -218,12 +218,6 @@ describe Puppet::Transaction do
                 @transaction.add_metrics_to_report(@report)
             end
         end
-
-        it "should set the transaction time to the current time" do
-            Time.expects(:now).returns "now"
-            @report.expects(:time=).with("now")
-            @transaction.add_metrics_to_report(@report)
-        end
     end
 
     describe "when prefetching" do
diff --git a/spec/unit/transaction/report.rb b/spec/unit/transaction/report.rb
index 478c941..730f83b 100755
--- a/spec/unit/transaction/report.rb
+++ b/spec/unit/transaction/report.rb
@@ -15,6 +15,11 @@ describe Puppet::Transaction::Report do
         r.name.should == r.host
     end
 
+    it "should create an initialization timestamp" do
+        Time.expects(:now).returns "mytime"
+        Puppet::Transaction::Report.new.time.should == "mytime"
+    end
+
     describe "when accepting logs" do
         before do
             @report = Puppet::Transaction::Report.new

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list