summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-28 05:39:59 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-10-28 05:39:59 +0000
commitb6c63f6924250a14e998f4256e81c30e950fed99 (patch)
tree8915ec8881f2389b208dfda27a12d11f69730398 /bin
parent0ae5e3392597452acf6a2e9f0d4ac976b8ec9846 (diff)
Central logging now works, although there appear to be a few kinks to work out.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@732 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppet8
-rwxr-xr-xbin/puppetd29
-rwxr-xr-xbin/puppetmasterd35
3 files changed, 36 insertions, 36 deletions
diff --git a/bin/puppet b/bin/puppet
index 84c910e97..58b0772b8 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -118,12 +118,10 @@ begin
when "--debug"
debug = true
when "--logdest"
- # FIXME we should be able to have log.rb check the validity of the dst
- case arg
- when "syslog", "console", /^\//:
+ begin
Puppet[:logdest] = arg
- else
- $stderr.puts "Invalid log destination %s" % arg
+ rescue => detail
+ $stderr.puts detail.to_s
end
when "--vardir"
Puppet[:puppetvar] = arg
diff --git a/bin/puppetd b/bin/puppetd
index 68cfad09d..98d64844f 100755
--- a/bin/puppetd
+++ b/bin/puppetd
@@ -138,8 +138,10 @@ begin
exit
when "--verbose"
Puppet[:loglevel] = :info
+ Puppet[:logdest] = :console
when "--debug"
Puppet[:loglevel] = :debug
+ Puppet[:logdest] = :console
when "--noop"
Puppet[:noop] = true
when "--ssldir"
@@ -151,12 +153,10 @@ begin
when "--port"
args[:Port] = arg
when "--logdest"
- # FIXME we should be able to have log.rb check the validity of the dst
- case arg
- when "syslog", "console", /^\//:
+ begin
Puppet[:logdest] = arg
- else
- $stderr.puts "Invalid log destination %s" % arg
+ rescue => detail
+ $stderr.puts detail.to_s
end
when "--vardir"
Puppet[:puppetvar] = arg
@@ -176,16 +176,28 @@ end
bg = false
-unless Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info
- bg = true
+if Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info
+ args[:Daemonize] = false
+else
+ args[:Daemonize] = true
end
args[:Server] = server
if fqdn
args[:FQDN] = fqdn
end
+
+logdest = args[:Server]
+
+if args.include?(:Port)
+ logdest += ":" + args[:Port]
+end
+
+Puppet[:logdest] = logdest
+
client = Puppet::Client::MasterClient.new(args)
+
unless client.readcert
if waitforcert
begin
@@ -206,9 +218,6 @@ unless client.readcert
end
if bg
- unless Puppet[:logdest] == :file
- Puppet[:logdest] = Puppet[:logfile]
- end
client.daemonize
end
diff --git a/bin/puppetmasterd b/bin/puppetmasterd
index a72f2327d..6471316b2 100755
--- a/bin/puppetmasterd
+++ b/bin/puppetmasterd
@@ -141,6 +141,7 @@ begin
Puppet[:puppetconf] = arg
when "--debug"
Puppet[:debug] = true
+ Puppet[:logdest] = :console
when "--fsconfig"
unless FileTest.exists?(arg)
$stderr.puts "File server configuration file %s does not exist" %
@@ -170,12 +171,10 @@ begin
when "--ssldir"
Puppet[:ssldir] = arg
when "--logdest"
- # FIXME we should be able to have log.rb check the validity of the dst
- case arg
- when "syslog", "console", /^\//:
+ begin
Puppet[:logdest] = arg
- else
- $stderr.puts "Invalid log destination %s" % arg
+ rescue => detail
+ $stderr.puts detail.to_s
end
when "--vardir"
Puppet[:puppetvar] = arg
@@ -184,6 +183,7 @@ begin
exit
when "--verbose"
Puppet[:loglevel] = :info
+ Puppet[:logdest] = :console
else
$stderr.puts "Invalid option '#{opt}'"
exit(1)
@@ -199,19 +199,16 @@ rescue GetoptLong::InvalidOption => detail
exit(1)
end
-bg = false
-
-unless Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info
- bg = true
-end
-
-if bg
- Puppet[:logdest] = Puppet[:masterlog]
+if Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info or parseonly
+ args[:Daemonize] = false
+else
+ args[:Daemonize] = true
end
handlers = {
:Master => master,
- :Status => {}
+ :Status => {},
+ :Logger => {}
}
@@ -222,9 +219,9 @@ end
unless fs.include?(:Config)
if File.exists?(Puppet[:fileserverconfig])
fs[:Config] = Puppet[:fileserverconfig]
- else
- Puppet.notice "File server config %s does not exist; skipping file serving" %
- Puppet[:fileserverconfig]
+ #else
+ # Puppet.notice "File server config %s does not exist; skipping file serving" %
+ # Puppet[:fileserverconfig]
end
end
@@ -248,10 +245,6 @@ if parseonly
exit(0)
end
-if bg
- server.daemonize
-end
-
trap(:INT) {
server.shutdown
}