Hello,

the incident #2527 is related to the lack of control of loglevel on
puppetd program.

This lack is still present in 0.25.1.
I wrote a patch for puppetd.rb code (located at
/usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb on my client).

This patch adds an option "--loglevel" which accept
debug/notice/warning/... parameters. This loglevel is applied, appart if
an other option set the loglevel (i.e. --test).
If the given loglevel is not valid the current default loglevel is used.

As I'm not very familiar with ruby code neigther with puppet code
structure, please feel free to review it.

Here is the patch:
--- 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


Regards,
--
Yannick


--

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