[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:31:01 UTC 2010
The following commit has been merged in the upstream branch:
commit 386b3e567f09c1ff1eb8ba4bb0a4f6432d3fab31
Author: Luke Kanies <luke at reductivelabs.com>
Date: Tue Jan 19 23:24:24 2010 -0800
Fixing #2759 - reports now have complete change info
This includes every event generated in the transaction
and a Resource::Status object for each resource managed,
with per-resource information in it.
Signed-off-by: Luke Kanies <luke at reductivelabs.com>
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index 9da761a..b49d122 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -330,8 +330,6 @@ class Puppet::Transaction
@event_manager = Puppet::Transaction::EventManager.new(self)
@resource_harness = Puppet::Transaction::ResourceHarness.new(self)
-
- @resource_status = {}
end
# Prefetch any providers that support it. We don't support prefetching
@@ -399,11 +397,11 @@ class Puppet::Transaction
end
def add_resource_status(status)
- @resource_status[status.resource] = status
+ report.add_resource_status status
end
def resource_status(resource)
- @resource_status[resource.to_s]
+ report.resource_statuses[resource.to_s]
end
# Roll all completed changes back.
diff --git a/lib/puppet/transaction/event_manager.rb b/lib/puppet/transaction/event_manager.rb
index 89c4b92..a6ca8a2 100644
--- a/lib/puppet/transaction/event_manager.rb
+++ b/lib/puppet/transaction/event_manager.rb
@@ -13,10 +13,6 @@ class Puppet::Transaction::EventManager
transaction.relationship_graph
end
- def report
- transaction.report
- end
-
# Respond to any queued events for this resource.
def process_events(resource)
restarted = false
@@ -37,8 +33,6 @@ class Puppet::Transaction::EventManager
def queue_event(resource, event)
@events << event
- report.register_event event
-
# Collect the targets of any subscriptions to those events. We pass
# the parent resource in so it will override the source in the events,
# since eval_generated children can't have direct relationships.
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 5a0332f..787ef19 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -10,7 +10,7 @@ class Puppet::Transaction::Report
indirects :report, :terminus_class => :processor
- attr_reader :events, :logs, :metrics, :host, :time
+ attr_reader :resource_statuses, :logs, :metrics, :host, :time
# This is necessary since Marshall doesn't know how to
# dump hash with default proc (see below @records)
@@ -23,10 +23,14 @@ class Puppet::Transaction::Report
return self
end
+ def add_resource_status(status)
+ @resource_statuses[status.resource] = status
+ end
+
def initialize
@metrics = {}
@logs = []
- @events = []
+ @resource_statuses = {}
@host = Puppet[:certname]
@time = Time.now
end
@@ -46,10 +50,6 @@ class Puppet::Transaction::Report
@metrics[metric.name] = metric
end
- def register_event(event)
- @events << event
- end
-
# Provide a summary of this report.
def summary
ret = ""
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index fba2518..e2ab007 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -29,6 +29,13 @@ describe Puppet::Transaction do
@transaction.resource_status(resource.to_s).should equal(status)
end
+ it "should add provided resource statuses to its report" do
+ resource = Puppet::Type.type(:notify).new :title => "foobar"
+ status = Puppet::Resource::Status.new(resource)
+ @transaction.add_resource_status(status)
+ @transaction.report.resource_statuses[resource.to_s].should equal(status)
+ end
+
it "should return nil when asked for a status that has not been created" do
@transaction.resource_status("File[/foo]").should be_nil
end
diff --git a/spec/unit/transaction/event_manager.rb b/spec/unit/transaction/event_manager.rb
index 5503ad3..7d8fb8a 100755
--- a/spec/unit/transaction/event_manager.rb
+++ b/spec/unit/transaction/event_manager.rb
@@ -20,15 +20,6 @@ describe Puppet::Transaction::EventManager do
manager.relationship_graph.should == "mygraph"
end
- it "should delegate its report to the transaction" do
- transaction = stub 'transaction'
- manager = Puppet::Transaction::EventManager.new(transaction)
-
- transaction.expects(:report).returns "myreport"
-
- manager.report.should == "myreport"
- end
-
describe "when queueing events" do
before do
@manager = Puppet::Transaction::EventManager.new(@transaction)
@@ -36,9 +27,7 @@ describe Puppet::Transaction::EventManager do
@resource = stub("resource", :self_refresh? => false, :deleting => false)
@graph = stub 'graph', :matching_edges => [], :resource => @resource
- @report = stub 'report', :register_event => nil
@manager.stubs(:relationship_graph).returns @graph
- @manager.stubs(:report).returns @report
@event = Puppet::Transaction::Event.new(:name => :foo, :resource => @resource)
end
@@ -110,11 +99,6 @@ describe Puppet::Transaction::EventManager do
@manager.queue_event(@resource, @event)
end
-
- it "should add each event to the transaction report's event list" do
- @manager.report.expects(:register_event).with(@event)
- @manager.queue_event(@resource, @event)
- end
end
describe "when queueing events for a resource" do
diff --git a/spec/unit/transaction/report.rb b/spec/unit/transaction/report.rb
index 730f83b..5be625e 100755
--- a/spec/unit/transaction/report.rb
+++ b/spec/unit/transaction/report.rb
@@ -36,15 +36,15 @@ describe Puppet::Transaction::Report do
end
end
- describe "when accepting events" do
+ describe "when accepting resource statuses" do
before do
@report = Puppet::Transaction::Report.new
end
- it "should add each event to its event list" do
- event = stub 'event'
- @report.register_event event
- @report.events.should be_include(event)
+ it "should add each status to its status list" do
+ status = stub 'status', :resource => "foo"
+ @report.add_resource_status status
+ @report.resource_statuses["foo"].should equal(status)
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list