diff options
author | Luke Kanies <luke@madstop.com> | 2009-11-04 17:23:38 -0500 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 242209d251c7807378d3af6d9bffbc9ed59be723 (patch) | |
tree | c72f80f7b75e228eaa975a5cff10bee2f02bf512 | |
parent | a4b77f61f26b20a48e0e55f8fc8bfef338878e6e (diff) | |
download | puppet-242209d251c7807378d3af6d9bffbc9ed59be723.tar.gz puppet-242209d251c7807378d3af6d9bffbc9ed59be723.tar.xz puppet-242209d251c7807378d3af6d9bffbc9ed59be723.zip |
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@madstop.com>
-rw-r--r-- | lib/puppet/transaction.rb | 11 | ||||
-rw-r--r-- | lib/puppet/transaction/report.rb | 1 | ||||
-rwxr-xr-x | spec/unit/transaction.rb | 6 | ||||
-rwxr-xr-x | spec/unit/transaction/report.rb | 5 |
4 files changed, 8 insertions, 15 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index aee541fb1..7e478abb2 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 45a249f48..5a0332f66 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 3adecf692..a4d6b1e3a 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 478c941f5..730f83bd4 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 |