# File lib/puppet/configurer.rb, line 123
123:   def run(options = {})
124:     begin
125:       prepare(options)
126:     rescue SystemExit,NoMemoryError
127:       raise
128:     rescue Exception => detail
129:       puts detail.backtrace if Puppet[:trace]
130:       Puppet.err "Failed to prepare catalog: #{detail}"
131:     end
132: 
133:     options[:report] ||= Puppet::Transaction::Report.new("apply")
134:     report = options[:report]
135:     Puppet::Util::Log.newdestination(report)
136: 
137:     if catalog = options[:catalog]
138:       options.delete(:catalog)
139:     elsif ! catalog = retrieve_catalog
140:       Puppet.err "Could not retrieve catalog; skipping run"
141:       return
142:     end
143: 
144:     report.configuration_version = catalog.version
145: 
146:     transaction = nil
147: 
148:     begin
149:       benchmark(:notice, "Finished catalog run") do
150:         transaction = catalog.apply(options)
151:       end
152:       report
153:     rescue => detail
154:       puts detail.backtrace if Puppet[:trace]
155:       Puppet.err "Failed to apply catalog: #{detail}"
156:       return
157:     end
158:   ensure
159:     # Make sure we forget the retained module_directories of any autoload
160:     # we might have used.
161:     Thread.current[:env_module_directories] = nil
162: 
163:     # Now close all of our existing http connections, since there's no
164:     # reason to leave them lying open.
165:     Puppet::Network::HttpPool.clear_http_instances
166:     execute_postrun_command
167: 
168:     Puppet::Util::Log.close(report)
169: 
170:     send_report(report, transaction)
171:   end