diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2010-12-16 16:23:52 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2010-12-16 16:23:52 -0800 |
| commit | 519e3857c7edf0d007dd3d4924d27ae552a9b457 (patch) | |
| tree | 5ca895fe8ce30b8a93c0c36461449a7b8eb418d7 /lib/puppet | |
| parent | 367633b7e67ff127c0fc8a12c2268941572a7837 (diff) | |
| parent | d516f6385e0ee044603c403ecc6f96606730f8f2 (diff) | |
Merge branch 'ticket/2.6.next/5493' into 2.6.next
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/application/apply.rb | 20 | ||||
| -rw-r--r-- | lib/puppet/application/inspect.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/configurer.rb | 16 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/transaction/report.rb | 6 |
5 files changed, 17 insertions, 29 deletions
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 59a95d35a..33a70ce8a 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -123,25 +123,9 @@ class Puppet::Application::Apply < Puppet::Application require 'puppet/configurer' configurer = Puppet::Configurer.new - configurer.execute_prerun_command + report = configurer.run(:skip_plugin_download => true, :catalog => catalog) - # And apply it - if Puppet[:report] - report = configurer.initialize_report - Puppet::Util::Log.newdestination(report) - end - transaction = catalog.apply - - configurer.execute_postrun_command - - if Puppet[:report] - Puppet::Util::Log.close(report) - configurer.send_report(report, transaction) - else - transaction.generate_report - end - - exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? transaction.report.exit_status : 0 ) + exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? report.exit_status : 0 ) rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts detail.message diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index c28fef326..caa32a7c2 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -49,6 +49,8 @@ class Puppet::Application::Inspect < Puppet::Application raise "Could not find catalog for #{Puppet[:certname]}" end + @report.configuration_version = catalog.version + retrieval_time = Time.now - retrieval_starttime @report.add_times("config_retrieval", retrieval_time) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 31d31c2d2..070176554 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -72,17 +72,13 @@ class Puppet::Configurer @splayed = false end - def initialize_report - Puppet::Transaction::Report.new - end - # Prepare for catalog retrieval. Downloads everything necessary, etc. - def prepare + def prepare(options) dostorage - download_plugins + download_plugins unless options[:skip_plugin_download] - download_fact_plugins + download_fact_plugins unless options[:skip_plugin_download] execute_prerun_command end @@ -126,7 +122,7 @@ class Puppet::Configurer # which accepts :tags and :ignoreschedules. def run(options = {}) begin - prepare + prepare(options) rescue SystemExit,NoMemoryError raise rescue Exception => detail @@ -134,7 +130,7 @@ class Puppet::Configurer Puppet.err "Failed to prepare catalog: #{detail}" end - options[:report] ||= initialize_report + options[:report] ||= Puppet::Transaction::Report.new("apply") report = options[:report] Puppet::Util::Log.newdestination(report) @@ -145,6 +141,8 @@ class Puppet::Configurer return end + report.configuration_version = catalog.version + transaction = nil begin diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index dcd9aad0a..2d49062dd 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -238,7 +238,7 @@ class Puppet::Transaction def initialize(catalog) @catalog = catalog - @report = Report.new + @report = Report.new("apply", catalog.version) @event_manager = Puppet::Transaction::EventManager.new(self) diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index 75c08fc7a..8a928454f 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -10,6 +10,7 @@ class Puppet::Transaction::Report indirects :report, :terminus_class => :processor + attr_accessor :configuration_version attr_reader :resource_statuses, :logs, :metrics, :host, :time, :kind # This is necessary since Marshall doesn't know how to @@ -49,7 +50,7 @@ class Puppet::Transaction::Report calculate_event_metrics end - def initialize(kind = "apply") + def initialize(kind, configuration_version=nil) @metrics = {} @logs = [] @resource_statuses = {} @@ -57,6 +58,9 @@ class Puppet::Transaction::Report @host = Puppet[:certname] @time = Time.now @kind = kind + @report_format = 2 + @puppet_version = Puppet.version + @configuration_version = configuration_version end def name |
