summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-03 17:32:40 -0500
committerLuke Kanies <luke@madstop.com>2007-10-03 17:32:40 -0500
commitf8c8efeff6f08cf8c23075311ce14bfd4decedb0 (patch)
tree4e0c39069fdff45f003b7e51783e6c0f579006b6 /bin
parent5d50ca790e7f752e07da84197b52ff84d2dcfdb4 (diff)
parent1be1db91c2ff3103c900da9ba3a3ba533d2587e7 (diff)
downloadpuppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.tar.gz
puppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.tar.xz
puppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.zip
Merge branch 'master' of git://michaelobrien.info/puppet
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppetd52
-rwxr-xr-xbin/puppetmasterd37
2 files changed, 37 insertions, 52 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
diff --git a/bin/puppetmasterd b/bin/puppetmasterd
index 51c714b15..acbafa59c 100755
--- a/bin/puppetmasterd
+++ b/bin/puppetmasterd
@@ -7,7 +7,7 @@
#
# = Usage
#
-# puppetmasterd [-D|--daemonize] [-d|--debug] [-h|--help]
+# puppetmasterd [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help]
# [-l|--logdest <file>|console|syslog] [--nobucket] [--nonodes]
# [-v|--verbose] [-V|--version]
#
@@ -28,11 +28,13 @@
# '--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. Causes the daemon not to go into the background.
+# Enable full debugging.
#
# help::
# Print this help message.
@@ -53,7 +55,7 @@
# Do not start the reports server.
#
# verbose::
-# Enable verbosity. Causes the daemon not to go into the background.
+# Enable verbosity.
#
# version::
# Print the puppet version number and exit.
@@ -82,7 +84,6 @@ require 'puppet'
require 'puppet/sslcertificates'
options = [
- [ "--daemonize", "-D", GetoptLong::NO_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
@@ -117,8 +118,8 @@ options = {
begin
result.each { |opt,arg|
case opt
- when "--daemonize"
- options[:daemonize] = true
+ # First check to see if the argument is a valid configuration parameter;
+ # if so, set it. NOTE: there is a catch-all at the bottom for defaults.rb
when "--debug"
options[:debug] = true
when "--help"
@@ -161,6 +162,9 @@ rescue GetoptLong::InvalidOption => detail
exit(1)
end
+# Now parse the config
+Puppet.parse_config
+
# Handle the logging settings.
if options[:debug] or options[:verbose]
if options[:debug]
@@ -169,7 +173,7 @@ if options[:debug] or options[:verbose]
Puppet::Util::Log.level = :info
end
- unless options[:daemonize]
+ unless Puppet[:daemonize]
Puppet::Util::Log.newdestination(:console)
options[:setdest] = true
end
@@ -179,24 +183,11 @@ unless options[:setdest]
Puppet::Util::Log.newdestination(:syslog)
end
-# Now parse the config
-Puppet.parse_config
-
Puppet.genconfig
Puppet.genmanifest
require 'etc'
-# 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
-
handlers = {
:Status => {},
}
@@ -288,7 +279,7 @@ if Puppet[:servertype] == "webrick"
end
Puppet.settraps
-if options[:daemonize]
+if Puppet[:daemonize]
server.daemonize
end