diff options
-rwxr-xr-x | bin/puppetd | 20 | ||||
-rw-r--r-- | lib/puppet/log.rb | 28 | ||||
-rw-r--r-- | lib/puppet/parser/scope.rb | 2 | ||||
-rwxr-xr-x | lib/puppet/server/logger.rb | 5 | ||||
-rw-r--r-- | lib/puppet/server/servlet.rb | 8 |
5 files changed, 35 insertions, 28 deletions
diff --git a/bin/puppetd b/bin/puppetd index 98d64844f..af92be6c0 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -12,7 +12,7 @@ # [--ssldir <cert directory>] [-l|--logdest <syslog|<file>|console>] # [--fqdn <host name>] [-p|--port <port>] [-s|--server <server>] # [-w|--waitforcert <seconds>] [-c|--confdir <configuration directory>] -# [--vardir <var directory>] +# [--vardir <var directory>] [--centrallogging] # # = Description # @@ -29,6 +29,10 @@ # # = Options # +# centrallogging:: +# Send all produced logs to the central puppetmasterd system. This currently +# results in a significant slowdown, so it is not recommended. +# # confdir:: # The configuration root directory, where +puppetmasterd+ defaults to looking # for all of its configuration files. Defaults to +/etc/puppet+. @@ -100,6 +104,7 @@ rescue LoadError end result = GetoptLong.new( + [ "--centrallogging", GetoptLong::NO_ARGUMENT ], [ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ], [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], [ "--fqdn", "-f", GetoptLong::REQUIRED_ARGUMENT ], @@ -121,9 +126,12 @@ args = {} waitforcert = false +centrallogs = false begin result.each { |opt,arg| case opt + when "--centrallogging" + centrallogs = true when "--confdir" Puppet[:puppetconf] = arg when "--help" @@ -187,13 +195,15 @@ if fqdn args[:FQDN] = fqdn end -logdest = args[:Server] +if centrallogs + logdest = args[:Server] -if args.include?(:Port) - logdest += ":" + args[:Port] + if args.include?(:Port) + logdest += ":" + args[:Port] + end + Puppet[:logdest] = logdest end -Puppet[:logdest] = logdest client = Puppet::Client::MasterClient.new(args) diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index ab2670f13..1c9a5bd7a 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -182,13 +182,18 @@ module Puppet # :nodoc: ] + RESET end when Puppet::Client::LogClient - # For now, to avoid a loop, don't send remote messages unless msg.is_a?(String) or msg.remote begin #puts "would have sent %s" % msg #puts "would have sent %s" % # CGI.escape(Marshal::dump(msg)) - dest.addlog(CGI.escape(Marshal::dump(msg))) + begin + tmp = CGI.escape(Marshal::dump(msg)) + rescue => detail + puts "Could not dump: %s" % detail.to_s + return + end + dest.addlog(tmp) #dest.addlog(msg.to_s) sleep(0.5) rescue => detail @@ -230,7 +235,7 @@ module Puppet # :nodoc: @levels.include?(level) end - attr_accessor :level, :message, :source, :time, :tags, :path, :remote + attr_accessor :level, :message, :source, :time, :tags, :remote def initialize(args) unless args.include?(:level) && args.include?(:message) @@ -257,23 +262,18 @@ module Puppet # :nodoc: @tags = args[:tags] end - if args.include?(:path) - @path = args[:path] - end - if args.include?(:source) - @source = args[:source] + # We can't store the actual source, we just store the path + if args[:source].respond_to?(:path) + @source = args[:source].path + else + @source = args[:source].to_s + end unless defined? @tags and @tags if @source.respond_to?(:tags) @tags = @source.tags end end - - unless defined? @path and @path - if @source.respond_to?(:path) - @path = @source.path - end - end else @source = "Puppet" end diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 66779cc0f..89e6ab75d 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -167,7 +167,7 @@ module Puppet # I should do something to add the node as an object with tags # but that will possibly end up with far too many tags. - self.logtags + #self.logtags return objects end diff --git a/lib/puppet/server/logger.rb b/lib/puppet/server/logger.rb index 7afad92b9..0ee2d75f0 100755 --- a/lib/puppet/server/logger.rb +++ b/lib/puppet/server/logger.rb @@ -27,13 +27,8 @@ class Server # :nodoc: if client if ! message.source or message.source == "Puppet" - #unless message.source or message.source != "Puppet" message.source = client - else - puts message.source.inspect end - else - puts "No client" end Puppet::Log.newmessage(message) diff --git a/lib/puppet/server/servlet.rb b/lib/puppet/server/servlet.rb index 4474fa640..f0b32efb0 100644 --- a/lib/puppet/server/servlet.rb +++ b/lib/puppet/server/servlet.rb @@ -153,9 +153,11 @@ class Server if nameary.nil? Puppet.warning "Could not retrieve server name from cert" else - Puppet.debug "Overriding %s with cert name %s" % - [@client, nameary[1]] - @client = nameary[1] + unless @client == nameary[1] + Puppet.debug "Overriding %s with cert name %s" % + [@client, nameary[1]] + @client = nameary[1] + end end end #if request.server_cert |