diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-01-05 15:54:00 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-01-05 15:54:00 -0800 |
| commit | 19eb1e78e115d10bfb822e510213e4fab9cd2599 (patch) | |
| tree | d5068dfd7a3890c7b5961779c87681b930cf3144 /lib/puppet/application | |
| parent | cc1f2b39a65e8b74c8e59a2bf7d8f47a35985ee4 (diff) | |
| parent | 83ac3e789ddc8dbf40c93460032474870fb16c54 (diff) | |
| download | puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.tar.gz puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.tar.xz puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.zip | |
Merge branch '2.6.next' into 2.6.x
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/apply.rb | 20 | ||||
| -rw-r--r-- | lib/puppet/application/inspect.rb | 18 |
2 files changed, 14 insertions, 24 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..c7be893c7 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -49,10 +49,10 @@ class Puppet::Application::Inspect < Puppet::Application raise "Could not find catalog for #{Puppet[:certname]}" end - retrieval_time = Time.now - retrieval_starttime - @report.add_times("config_retrieval", retrieval_time) + @report.configuration_version = catalog.version - starttime = Time.now + inspect_starttime = Time.now + @report.add_times("config_retrieval", inspect_starttime - retrieval_starttime) catalog.to_ral.resources.each do |ral_resource| audited_attributes = ral_resource[:audit] @@ -62,13 +62,19 @@ class Puppet::Application::Inspect < Puppet::Application status = Puppet::Resource::Status.new(ral_resource) audited_attributes.each do |name| - event = ral_resource.event(:previous_value => audited_resource[name], :property => name, :status => "audit", :message => "inspected value is #{audited_resource[name].inspect}") - status.add_event(event) + next if audited_resource[name].nil? + # Skip :absent properties of :absent resources. Really, it would be nicer if the RAL returned nil for those, but it doesn't. ~JW + if name == :ensure or audited_resource[:ensure] != :absent or audited_resource[name] != :absent + event = ral_resource.event(:previous_value => audited_resource[name], :property => name, :status => "audit", :message => "inspected value is #{audited_resource[name].inspect}") + status.add_event(event) + end end @report.add_resource_status(status) end - @report.add_metric(:time, {"config_retrieval" => retrieval_time, "inspect" => Time.now - starttime}) + finishtime = Time.now + @report.add_times("inspect", finishtime - inspect_starttime) + @report.finalize_report begin @report.save |
