diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-24 06:37:00 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-24 06:37:00 +0000 |
| commit | 9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec (patch) | |
| tree | 02e58bed60b09dae80c5288618b233e91b64a84c | |
| parent | ae2575b45de1e8f4c0ec956cebe0eed2bafbcf57 (diff) | |
| download | puppet-9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec.tar.gz puppet-9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec.tar.xz puppet-9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec.zip | |
Fixing some logging issues
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@849 980ebf18-57e1-0310-9a29-db15c13687c0
| -rwxr-xr-x | bin/puppetd | 15 | ||||
| -rwxr-xr-x | bin/puppetmasterd | 10 | ||||
| -rw-r--r-- | lib/puppet.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/client.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/client/master.rb | 1 | ||||
| -rw-r--r-- | lib/puppet/log.rb | 18 |
6 files changed, 38 insertions, 11 deletions
diff --git a/bin/puppetd b/bin/puppetd index c082e2a80..18cfe7107 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -144,6 +144,8 @@ onetime = false centrallogs = false +setdest = false + begin result.each { |opt,arg| case opt @@ -164,9 +166,11 @@ begin when "--verbose" Puppet[:loglevel] = :info Puppet[:logdest] = :console + setdest = true when "--debug" Puppet[:loglevel] = :debug Puppet[:logdest] = :console + setdest = true when "--noop" Puppet[:noop] = true when "--schedule" @@ -205,14 +209,16 @@ rescue GetoptLong::InvalidOption => detail exit(1) end -bg = false - if Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info args[:Daemonize] = false else args[:Daemonize] = true end +unless setdest + Puppet[:logdest] = :syslog +end + args[:Server] = server if fqdn args[:FQDN] = fqdn @@ -228,7 +234,7 @@ if centrallogs end -Puppet.info "Starting Puppet client version %s" % [Puppet.version] +Puppet.notice "Starting Puppet client version %s" % [Puppet.version] client = Puppet::Client::MasterClient.new(args) @@ -251,7 +257,8 @@ unless client.readcert end end -if bg +if args[:Daemonize] + #exit(13) client.daemonize end diff --git a/bin/puppetmasterd b/bin/puppetmasterd index 685ff6485..6dc5a3fa9 100755 --- a/bin/puppetmasterd +++ b/bin/puppetmasterd @@ -154,6 +154,8 @@ havebucket = true parseonly = false +setdest = false + begin result.each { |opt,arg| case opt @@ -164,6 +166,7 @@ begin when "--debug" Puppet[:debug] = true Puppet[:logdest] = :console + setdest = true when "--fsconfig" unless FileTest.exists?(arg) $stderr.puts "File server configuration file %s does not exist" % @@ -197,6 +200,7 @@ begin when "--logdest" begin Puppet[:logdest] = arg + setdest = true rescue => detail $stderr.puts detail.to_s end @@ -210,6 +214,7 @@ begin puts "%s" % Puppet.version exit when "--verbose" + setdest = true Puppet[:loglevel] = :info Puppet[:logdest] = :console else @@ -275,6 +280,9 @@ handlers = { :Logger => {} } +unless setdest + Puppet[:logdest] = :syslog +end if haveca handlers[:CA] = ca @@ -299,6 +307,8 @@ end args[:Handlers] = handlers +Puppet.notice "Starting Puppet server version %s" % [Puppet.version] + begin # use the default, um, everything #server = Puppet::Server.new(:CA => ca) diff --git a/lib/puppet.rb b/lib/puppet.rb index 2e1a88e66..d48d45b94 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -110,7 +110,7 @@ PUPPETVERSION = '0.11.2' :parseonly => false, :puppetport => 8139, :masterport => 8140, - :runinterval => 60, + :runinterval => 500, # 30 minutes } # If we're running the standalone puppet process as a non-root user, 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: |
