The refactors for 2.6.x stopped "puppet apply" from saving reports; this fix
adds report saving back to puppet apply but leaves a number of related issues
(code path consolidation, report contents, etc.) unresolved for future patches
in the 2.6.x series or more significant refactoring in 2.7.x.

Signed-off-by: Markus Roberts <[email protected]>
---
 lib/puppet/application/apply.rb |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index bb4186d..d34260a 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -123,17 +123,22 @@ class Puppet::Application::Apply < Puppet::Application
       configurer.execute_prerun_command
 
       # And apply it
+      if Puppet[:report]
+        report = configurer.initialize_report
+        Puppet::Util::Log.newdestination(report)
+      end
       transaction = catalog.apply
 
       configurer.execute_postrun_command
 
-      status = 0
-      if not Puppet[:noop] and options[:detailed_exitcodes]
-        transaction.generate_report
-        exit(transaction.report.exit_status)
+      if Puppet[:report]
+        Puppet::Util::Log.close(report)
+        configurer.send_report(report, transaction)
       else
-        exit(0)
+        transaction.generate_report
       end
+
+      exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? 
transaction.report.exit_status : 0 )
     rescue => detail
       puts detail.backtrace if Puppet[:trace]
       $stderr.puts detail.message
-- 
1.7.0.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to