~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to lib/puppet/transaction.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2011-10-22 14:08:22 UTC
  • mfrom: (1.1.25) (3.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20111022140822-odxde5lohc45yhuz
Tags: 2.7.6-1
* New upstream release (CVE-2011-3872)
* Remove cherry-picked "groupadd_aix_warning" patch
* Install all new manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
  attr_accessor :configurator
17
17
 
18
18
  # The report, once generated.
19
 
  attr_accessor :report
 
19
  attr_reader :report
20
20
 
21
21
  # Routes and stores any events and subscriptions.
22
22
  attr_reader :event_manager
92
92
  # collects all of the changes, executes them, and responds to any
93
93
  # necessary events.
94
94
  def evaluate
95
 
    # Start logging.
96
 
    Puppet::Util::Log.newdestination(@report)
97
 
 
98
95
    prepare
99
96
 
100
97
    Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version
101
98
 
102
 
    begin
103
 
      relationship_graph.traverse do |resource|
104
 
        if resource.is_a?(Puppet::Type::Component)
105
 
          Puppet.warning "Somehow left a component in the relationship graph"
106
 
        else
107
 
          seconds = thinmark { eval_resource(resource) }
108
 
          resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config?
109
 
        end
 
99
    relationship_graph.traverse do |resource|
 
100
      if resource.is_a?(Puppet::Type::Component)
 
101
        Puppet.warning "Somehow left a component in the relationship graph"
 
102
      else
 
103
        seconds = thinmark { eval_resource(resource) }
 
104
        resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config?
110
105
      end
111
 
    ensure
112
 
      # And then close the transaction log.
113
 
      Puppet::Util::Log.close(@report)
114
106
    end
115
107
 
116
108
    Puppet.debug "Finishing transaction #{object_id}"
221
213
 
222
214
  # this should only be called by a Puppet::Type::Component resource now
223
215
  # and it should only receive an array
224
 
  def initialize(catalog)
 
216
  def initialize(catalog, report = nil)
225
217
    @catalog = catalog
226
218
 
227
 
    @report = Puppet::Transaction::Report.new("apply")
 
219
    @report = report || Puppet::Transaction::Report.new("apply", catalog.version)
228
220
 
229
221
    @event_manager = Puppet::Transaction::EventManager.new(self)
230
222