summaryrefslogtreecommitdiffstats
path: root/bin/puppetd
diff options
context:
space:
mode:
authorMichael V. O'Brien <michael@reductivelabs.com>2007-10-03 17:06:06 -0500
committerMichael V. O'Brien <michael@reductivelabs.com>2007-10-03 17:06:06 -0500
commit0b8893b3b8ffd391287a590b4f271edca70331da (patch)
treed95e932676c7d06310d20e0248e5bc4be89fa91b /bin/puppetd
parented8fa9b3458cacd67d9bd023a2a319c351e76e95 (diff)
downloadpuppet-0b8893b3b8ffd391287a590b4f271edca70331da.tar.gz
puppet-0b8893b3b8ffd391287a590b4f271edca70331da.tar.xz
puppet-0b8893b3b8ffd391287a590b4f271edca70331da.zip
Fixed #832. Added the '--no-daemonize' option to puppetd and puppetmasterd.
The default behavior of 'verbose' and 'debug' no longer cause puppetd and puppetmasterd to not daemonize.
Diffstat (limited to 'bin/puppetd')
-rwxr-xr-xbin/puppetd52
1 files changed, 23 insertions, 29 deletions
diff --git a/bin/puppetd b/bin/puppetd
index 8d112ca3a..6450d1806 100755
--- a/bin/puppetd
+++ b/bin/puppetd
@@ -8,7 +8,7 @@
#
# = Usage
#
-# puppetd [-D|--daemonize] [-d|--debug] [--disable] [--enable]
+# puppetd [-D|--daemonize|--no-daemonize] [-d|--debug] [--disable] [--enable]
# [-h|--help] [--fqdn <host name>] [-l|--logdest syslog|<file>|console]
# [-o|--onetime] [--serve <handler>] [-t|--test]
# [-V|--version] [-v|--verbose] [-w|--waitforcert <seconds>]
@@ -63,8 +63,10 @@
# '--genconfig'.
#
# daemonize::
-# Send the process into the background. This is the default unless
-# +verbose+ or +debug+ is enabled.
+# Send the process into the background. This is the default.
+#
+# no-daemonize::
+# Do not send the process into the background.
#
# debug::
# Enable full debugging.
@@ -161,7 +163,6 @@ require 'getoptlong'
options = [
[ "--centrallogging", GetoptLong::NO_ARGUMENT ],
- [ "--daemonize", "-D", GetoptLong::NO_ARGUMENT ],
[ "--disable", GetoptLong::NO_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--enable", GetoptLong::NO_ARGUMENT ],
@@ -201,9 +202,7 @@ begin
result.each { |opt,arg|
case opt
# First check to see if the argument is a valid configuration parameter;
- # if so, set it.
- when "--daemonize"
- options[:daemonize] = true
+ # if so, set it. NOTE: there is a catch-all at the bottom for defaults.rb
when "--disable"
options[:disable] = true
when "--serve"
@@ -215,17 +214,7 @@ begin
when "--enable"
options[:enable] = true
when "--test"
- # Enable all of the most common test options.
- Puppet.settings.handlearg("--ignorecache")
- Puppet.settings.handlearg("--no-usecacheonfailure")
- Puppet.settings.handlearg("--no-splay")
- Puppet.settings.handlearg("--show_diff")
- options[:onetime] = true
- options[:waitforcert] = 0
- unless Puppet::Util::Log.level == :debug
- Puppet::Util::Log.level = :info
- end
- Puppet::Util::Log.newdestination(:console)
+ options[:test] = true
when "--centrallogging"
options[:centrallogs] = true
when "--help"
@@ -276,6 +265,21 @@ end
# Now parse the config
Puppet.parse_config
+if options[:test]
+ # Enable all of the most common test options.
+ Puppet.settings.handlearg("--ignorecache")
+ Puppet.settings.handlearg("--no-usecacheonfailure")
+ Puppet.settings.handlearg("--no-splay")
+ Puppet.settings.handlearg("--show_diff")
+ Puppet.settings.handlearg("--no-daemonize")
+ options[:onetime] = true
+ options[:waitforcert] = 0
+ unless Puppet::Util::Log.level == :debug
+ Puppet::Util::Log.level = :info
+ end
+ Puppet::Util::Log.newdestination(:console)
+end
+
Puppet.genconfig
Puppet.genmanifest
@@ -284,16 +288,6 @@ if Puppet[:noop]
Puppet[:show_diff] = true
end
-# Default to daemonizing, but if verbose or debug is specified,
-# default to staying in the foreground.
-unless options.include?(:daemonize)
- if Puppet::Util::Log.level == :debug or Puppet::Util::Log.level == :info
- options[:daemonize] = false
- else
- options[:daemonize] = true
- end
-end
-
unless options[:setdest]
Puppet::Util::Log.newdestination(:syslog)
end
@@ -330,7 +324,7 @@ server = nil
# It'd be nice to daemonize later, but we have to daemonize before the
# waitforcert happens.
-if options[:daemonize]
+if Puppet[:daemonize]
client.daemonize
end