diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-06-10 14:03:47 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-06-10 14:03:47 -0700 |
| commit | 6996e0bbfb3559773e5fa0d133a7632dcb06b2d5 (patch) | |
| tree | 980f769d795cdbd8b3972e7ff2b6e503daffe4f9 /lib | |
| parent | caca469976cc8b5ff6c7f68d7324eecd35399176 (diff) | |
| download | puppet-6996e0bbfb3559773e5fa0d133a7632dcb06b2d5.tar.gz puppet-6996e0bbfb3559773e5fa0d133a7632dcb06b2d5.tar.xz puppet-6996e0bbfb3559773e5fa0d133a7632dcb06b2d5.zip | |
Do not needlessly create multiple reports when creating a transaction
Previously, the transaction would always create a report, which would
some times be overridden with a new report.
Now, the transaction optionally takes a report at initialization time,
and only creates a report of its own if none was provided.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/resource/catalog.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 9 |
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index a8668d844..8d4918bbf 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -132,9 +132,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph expire Puppet::Util::Storage.load if host_config? - transaction = Puppet::Transaction.new(self) + transaction = Puppet::Transaction.new(self, options[:report]) - transaction.report = options[:report] if options[:report] transaction.tags = options[:tags] if options[:tags] transaction.ignoreschedules = true if options[:ignoreschedules] diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 48154ad6f..16f201ec5 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -15,7 +15,7 @@ class Puppet::Transaction attr_accessor :sorted_resources, :configurator # The report, once generated. - attr_accessor :report + attr_reader :report # Routes and stores any events and subscriptions. attr_reader :event_manager @@ -228,13 +228,10 @@ class Puppet::Transaction # this should only be called by a Puppet::Type::Component resource now # and it should only receive an array - def initialize(catalog) + def initialize(catalog, report = nil) @catalog = catalog - - @report = Report.new("apply", catalog.version) - + @report = report || Report.new("apply", catalog.version) @event_manager = Puppet::Transaction::EventManager.new(self) - @resource_harness = Puppet::Transaction::ResourceHarness.new(self) end |
