Issue #2527 has been updated by Yannick Perret.

Note sure if I should re-open a bug or not: I'm now using 0.25.1, and this 
feature still seems to be missing.

I changed the puppetd.rb code in order to add a "--loglevel" option.
This option allow to change the loglevel registered at startup. It only applies 
if no other option set the loglevel (i.e. --test). If the given loglevel is not 
valid it uses the current default value (info).
As I'm not very familiar with ruby code, here is the patch (diff -u) for the 
version I have. Please let me know if I should use an other way to submit this.
--- puppetd.rb  2009-11-27 15:43:29.191196367 +0100
+++ puppetd.new.rb      2009-11-27 15:43:57.391197765 +0100
@@ -25,6 +25,7 @@
             :debug => false,
             :centrallogs => false,
             :setdest => false,
+           :loglevel => false,
             :enable => false,
             :disable => false,
             :client => true,
@@ -86,6 +87,10 @@
         @args[:Port] = arg
     end
 
+    option("--loglevel LOGLEVEL") do |arg|
+       options[:loglevel] = arg
+    end
+
     dispatch do
         return :onetime if options[:onetime]
         return :main
@@ -135,7 +140,30 @@
             if options[:debug]
                 Puppet::Util::Log.level = :debug
             else
-                Puppet::Util::Log.level = :info
+                if options[:loglevel]
+                   if options[:loglevel] == "debug"
+                       Puppet::Util::Log.level = :debug
+                   elsif options[:loglevel] == "info"
+                       Puppet::Util::Log.level = :info
+                   elsif options[:loglevel] == "notice"
+                       Puppet::Util::Log.level = :notice
+                   elsif options[:loglevel] == "warning"
+                       Puppet::Util::Log.level = :warning
+                   elsif options[:loglevel] == "err"
+                       Puppet::Util::Log.level = :err
+                   elsif options[:loglevel] == "alert"
+                       Puppet::Util::Log.level = :alert
+                   elsif options[:loglevel] == "emerg"
+                       Puppet::Util::Log.level = :emerg
+                   elsif options[:loglevel] == "crit"
+                       Puppet::Util::Log.level = :crit
+                   else
+                       Puppet.warning "Invalid loglevel %s. Using info." % 
options[:loglevel]
+                       Puppet::Util::Log.level = :info
+                   end
+                else
+                    Puppet::Util::Log.level = :info
+               end
             end
         end
 

----------------------------------------
Feature #2527: Cannot suppress notice messages from puppet
http://projects.reductivelabs.com/issues/2527

Author: Anselm Strauss
Status: Accepted
Priority: Low
Assigned to: 
Category: newfeature
Target version: 
Affected version: 0.24.8
Keywords: 
Branch: 


There is no option to run puppet quietly, so it only shows errors and warnings, 
notices are always shown. Maybe a --quiet switch besides the --verbose and 
--debug switches would not be bad. Or even better a more sophisticated log 
level option for filtering arbitrary log level messages and combinations of 
different levels.


-- 
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://reductivelabs.com/redmine/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