From 9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 24 Jan 2006 06:37:00 +0000 Subject: Fixing some logging issues git-svn-id: https://reductivelabs.com/svn/puppet/trunk@849 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/client.rb | 3 +++ lib/puppet/client/master.rb | 1 + lib/puppet/log.rb | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/client.rb b/lib/puppet/client.rb index c6061e0ef..dcf3dd439 100644 --- a/lib/puppet/client.rb +++ b/lib/puppet/client.rb @@ -130,6 +130,9 @@ module Puppet # Stick it in the loop EventLoop.current.monitor_timer timer + # Run once before we start following the timer + self.runnow + # And run indefinitely observe_signal timer, :alarm do if self.scheduled? diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index f0204c418..73217b2f0 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -15,6 +15,7 @@ class Puppet::Client::MasterClient < Puppet::Client # objects. For now, just descend into the tree and perform and # necessary manipulations. def apply + Puppet.notice "Beginning configuration run" dostorage() unless defined? @objects raise Puppet::Error, "Cannot apply; objects not defined" diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index 24a694be4..65043a463 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -80,6 +80,10 @@ module Puppet end end + def Log.destinations + return @destinations.keys + end + # Yield each valid level in turn def Log.eachlevel @levels.each { |level| yield level } @@ -159,11 +163,11 @@ module Puppet end end - # Route the actual message. FIXME There are lots of things this method should - # do, like caching, storing messages when there are not yet destinations, - # a bit more. - # It's worth noting that there's a potential for a loop here, if - # the machine somehow gets the destination set as itself. + # Route the actual message. FIXME There are lots of things this method + # should do, like caching, storing messages when there are not yet + # destinations, a bit more. It's worth noting that there's a potential + # for a loop here, if the machine somehow gets the destination set as + # itself. def Log.newmessage(msg) if @levels.index(msg.level) < @loglevel return @@ -179,7 +183,9 @@ module Puppet dest.send(msg.level, msg.to_s.gsub("%", '%%')) else dest.send(msg.level, "(%s) %s" % - [msg.source.to_s.gsub("%", ""), msg.to_s.gsub("%", '%%')] + [msg.source.to_s.gsub("%", ""), + msg.to_s.gsub("%", '%%') + ] ) end when File: -- cgit