diff options
author | Luke Kanies <luke@madstop.com> | 2007-10-03 17:32:40 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-10-03 17:32:40 -0500 |
commit | f8c8efeff6f08cf8c23075311ce14bfd4decedb0 (patch) | |
tree | 4e0c39069fdff45f003b7e51783e6c0f579006b6 | |
parent | 5d50ca790e7f752e07da84197b52ff84d2dcfdb4 (diff) | |
parent | 1be1db91c2ff3103c900da9ba3a3ba533d2587e7 (diff) | |
download | puppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.tar.gz puppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.tar.xz puppet-f8c8efeff6f08cf8c23075311ce14bfd4decedb0.zip |
Merge branch 'master' of git://michaelobrien.info/puppet
-rw-r--r-- | CHANGELOG | 7 | ||||
-rwxr-xr-x | bin/puppetd | 52 | ||||
-rwxr-xr-x | bin/puppetmasterd | 37 | ||||
-rw-r--r-- | lib/puppet.rb | 2 | ||||
-rw-r--r-- | lib/puppet/defaults.rb | 8 | ||||
-rw-r--r-- | lib/puppet/reference/configuration.rb | 12 | ||||
-rw-r--r-- | lib/puppet/util/settings.rb | 2 |
7 files changed, 61 insertions, 59 deletions
@@ -1,4 +1,11 @@ 0.23.2 (misspiggy) + Fixed #832. Added the '--no-daemonize' option to puppetd and + puppetmasterd. NOTE: The default behavior of 'verbose' and + 'debug' no longer cause puppetd and puppetmasterd to not + daemonize. + + Added k5login type. (#759) + Fixed CA race condition. (#693) Added shortname support to config.rb and refactored addargs 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 diff --git a/lib/puppet.rb b/lib/puppet.rb index c1f31e467..538a3335f 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -117,6 +117,8 @@ module Puppet # Load all of the configuration parameters. require 'puppet/defaults' + # Prints the contents of a config file with the available config elements, or it + # prints a single value of a config element. def self.genconfig if Puppet[:configprint] != "" val = Puppet[:configprint] diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index f76ae9b84..6f44919e2 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -131,7 +131,11 @@ module Puppet :diff => ["diff", "Which diff command to use when printing differences between files."], :show_diff => [false, "Whether to print a contextual diff when files are being replaced. The diff is printed on stdout, so this option is meaningless unless you are running Puppet interactively. - This feature currently requires the ``diff/lcs`` Ruby library."] + This feature currently requires the ``diff/lcs`` Ruby library."], + :daemonize => { :default => true, + :desc => "Send the process into the background. This is the default.", + :short => "D" + } ) hostname = Facter["hostname"].value @@ -339,7 +343,7 @@ module Puppet :owner => "root", :mode => 0644, :desc => "The file in which puppetd stores a list of the classes - associated with the retrieved configuratiion. Can be loaded in + associated with the retrieved configuration. Can be loaded in the separate ``puppet`` executable using the ``--loadclasses`` option."}, :puppetdlog => { :default => "$logdir/puppetd.log", diff --git a/lib/puppet/reference/configuration.rb b/lib/puppet/reference/configuration.rb index 4b09002b8..c37b2e7dd 100644 --- a/lib/puppet/reference/configuration.rb +++ b/lib/puppet/reference/configuration.rb @@ -73,10 +73,14 @@ the client configuration. Configuration Files +++++++++++++++++++ -As mentioned above, the configuration parameters can also be stored in a -configuration file, located in the configuration directory (`/etc/puppet` -by default). As of 0.23.0, all executables look for ``puppet.conf`` in their -configuration directory (although they previously looked for separate files). +As mentioned above, the configuration parameters can also be stored in a +configuration file, located in the configuration directory. As root, the +default configuration directory is ``/etc/puppet``, and as a regular user, the +default configuration directory is ``~user/.puppet``. As of 0.23.0, all +executables look for ``puppet.conf`` in their configuration directory +(although they previously looked for separate files). For example, +``puppet.conf`` is located at ``/etc/puppet/puppet.conf`` as root and +``~user/.puppet/puppet.conf`` as a regular user by default. All executables will set any parameters set within the ``main`` section, while each executable will also look for a section named for the executable diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 1478cd8a5..ab55fbd2b 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -562,7 +562,7 @@ class Puppet::Util::Settings return transport.to_configuration end - # Convert our list of objects into a configuration file. + # Convert our list of config elements into a configuration file. def to_config str = %{The configuration file for #{Puppet[:name]}. Note that this file is likely to have unused configuration parameters in it; any parameter that's |