Issue #5703 has been updated by James Turnbull.

Status changed from Requires CLA to be signed to In Topic Branch Pending Review

Morgan - thanks so much for signing the CLA!  

This is the proposed code. It'd be great to have this in a branch with a pull 
request too if possible but if you can't do it we'll handle it.  Many thanks 
again!

<pre>
diff --git a/configurer.rb b/configurer.rb 
index 31d31c2..194acc1 100644 
--- a/configurer.rb 
+++ b/configurer.rb 
@@ -41,11 +41,11 @@ class Puppet::Configurer 
   end 

   def execute_postrun_command 
-    execute_from_setting(:postrun_command) 
+    execute_from_setting(:postrun_command, Puppet[:print_postrun_output]) 
   end 

   def execute_prerun_command 
-    execute_from_setting(:prerun_command) 
+    execute_from_setting(:prerun_command, Puppet[:print_prerun_output]) 
   end 

   # Initialize and load storage 
@@ -200,11 +200,14 @@ class Puppet::Configurer 
     timeout 
   end 

-  def execute_from_setting(setting) 
+  def execute_from_setting(setting, print_output = false) 
     return if (command = Puppet[setting]) == "" 

     begin 
-      Puppet::Util.execute([command]) 
+      output = Puppet::Util.execute([command]) 
+      if print_output then 
+        Puppet.info(output) 
+      end 
     rescue => detail 
       raise CommandHookError, "Could not run command from #{setting}: 
#{detail}" 
     end 
diff --git a/defaults.rb b/defaults.rb 
index 4521a59..e0d2cda 100644 
--- a/defaults.rb 
+++ b/defaults.rb 
@@ -168,6 +168,12 @@ module Puppet 
     :postrun_command => ["", "A command to run after every agent run.  If 
this command returns a non-zero 
       return code, the entire Puppet run will be considered to have failed, 
even though it might have 
       performed work during the normal run."], 
+    :print_prerun_output => [false, 
+      "Boolean; whether to print output from the prerun_command at the 
'info' level." 
+    ], 
+    :print_postrun_output => [false, 
+      "Boolean; whether to print output from the postrun_command at the 
'info' level." 
+    ], 
     :freeze_main => [false, "Freezes the 'main' class, disallowing any code 
to be added to it.  This 
       essentially means that you can't have any code outside of a node, 
class, or definition other 
       than in the site manifest."] 
</pre>
----------------------------------------
Feature #5703: Print output from postrun_command and prerun_command
https://projects.puppetlabs.com/issues/5703

Author: Paul Berry
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: Morgan Haskel
Category: 
Target version: Telly
Affected Puppet version: 
Keywords: 
Branch: 


This ticket reflects a patch (and mailing list discussion) on the Puppet dev 
list with the subject line "Print output from postrun_command and 
prerun_command".

The basic idea is: add options print_prerun_output and print_postrun_output 
which cause Puppet to print the output of the prerun and postrun commands, 
respectively.

For more information please see dev list discussion.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to