127: def apply(options = {})
128: @applying = true
129:
130:
131:
132: expire
133:
134: Puppet::Util::Storage.load if host_config?
135: transaction = Puppet::Transaction.new(self)
136:
137: transaction.report = options[:report] if options[:report]
138: transaction.tags = options[:tags] if options[:tags]
139: transaction.ignoreschedules = true if options[:ignoreschedules]
140:
141: transaction.add_times :config_retrieval => self.retrieval_duration || 0
142:
143: begin
144: transaction.evaluate
145: rescue Puppet::Error => detail
146: puts detail.backtrace if Puppet[:trace]
147: Puppet.err "Could not apply complete catalog: #{detail}"
148: rescue => detail
149: puts detail.backtrace if Puppet[:trace]
150: Puppet.err "Got an uncaught exception of type #{detail.class}: #{detail}"
151: ensure
152:
153:
154: Puppet::Util::Storage.store if host_config?
155: end
156:
157: yield transaction if block_given?
158:
159: return transaction
160: ensure
161: @applying = false
162: cleanup
163: end