diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-16 02:46:50 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-16 02:46:50 +0000 |
| commit | 9a8636c3c22ca5b7d244e1a80e9c2bf8b4dffe8f (patch) | |
| tree | ca77633415402fc1c8589fff40ef329f7a87fb9a /lib | |
| parent | 86b33867b156f9d80bdccf895f16ec0ac3a8a204 (diff) | |
| download | puppet-9a8636c3c22ca5b7d244e1a80e9c2bf8b4dffe8f.tar.gz puppet-9a8636c3c22ca5b7d244e1a80e9c2bf8b4dffe8f.tar.xz puppet-9a8636c3c22ca5b7d244e1a80e9c2bf8b4dffe8f.zip | |
Moving all of the configuration parameters out of puppet.rb into puppet/configuration.rb, and adding a PATH setting as requested in #307, although it does not include a default.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1784 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet.rb | 158 | ||||
| -rw-r--r-- | lib/puppet/configuration.rb | 168 |
2 files changed, 170 insertions, 156 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index a0e382e57..71c7743a7 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -72,162 +72,8 @@ module Puppet @@config.setdefaults(section, hash) end - # If we're running the standalone puppet process as a non-root user, - # use basedirs that are in the user's home directory. - conf = nil - var = nil - if self.name == "puppet" and Puppet::SUIDManager.uid != 0 - conf = File.expand_path("~/.puppet") - var = File.expand_path("~/.puppet/var") - else - # Else, use system-wide directories. - conf = "/etc/puppet" - var = "/var/puppet" - end - - self.setdefaults(:puppet, - :confdir => [conf, "The main Puppet configuration directory."], - :vardir => [var, "Where Puppet stores dynamic and growing data."] - ) - - if self.name == "puppetmasterd" - self.setdefaults(:puppetmasterd, - :logdir => {:default => "$vardir/log", - :mode => 0750, - :owner => "$user", - :group => "$group", - :desc => "The Puppet log directory." - } - ) - else - self.setdefaults(:puppet, - :logdir => ["$vardir/log", "The Puppet log directory."] - ) - end - - self.setdefaults(:puppet, - :trace => [false, "Whether to print stack traces on some errors"], - :autoflush => [false, "Whether log files should always flush to disk."], - :syslogfacility => ["daemon", "What syslog facility to use when logging to - syslog. Syslog has a fixed list of valid facilities, and you must - choose one of those; you cannot just make one up."], - :statedir => { :default => "$vardir/state", - :mode => 01777, - :desc => "The directory where Puppet state is stored. Generally, - this directory can be removed without causing harm (although it - might result in spurious service restarts)." - }, - :rundir => { :default => "$vardir/run", - :mode => 01777, - :desc => "Where Puppet PID files are kept." - }, - :lockdir => { :default => "$vardir/locks", - :mode => 01777, - :desc => "Where lock files are kept." - }, - :statefile => { :default => "$statedir/state.yaml", - :mode => 0660, - :desc => "Where puppetd and puppetmasterd store state associated - with the running configuration. In the case of puppetmasterd, - this file reflects the state discovered through interacting - with clients." - }, - :ssldir => { - :default => "$confdir/ssl", - :mode => 0771, - :owner => "root", - :desc => "Where SSL certificates are kept." - }, - :genconfig => [false, - "Whether to just print a configuration to stdout and exit. Only makes - sense when used interactively. Takes into account arguments specified - on the CLI."], - :genmanifest => [false, - "Whether to just print a manifest to stdout and exit. Only makes - sense when used interactively. Takes into account arguments specified - on the CLI."], - :configprint => ["", - "Print the value of a specific configuration parameter. If a - parameter is provided for this, then the value is printed and puppet - exits. Comma-separate multiple values. For a list of all values, - specify 'all'. This feature is only available in Puppet versions - higher than 0.18.4."], - :color => [true, "Whether to use ANSI colors when logging to the console."], - :mkusers => [false, - "Whether to create the necessary user and group that puppetd will - run as."] - ) - - # Define the config default. - self.setdefaults(self.name, - :config => ["$confdir/#{self.name}.conf", - "The configuration file for #{self.name}."] - ) - - self.setdefaults("puppetmasterd", - :user => ["puppet", "The user puppetmasterd should run as."], - :group => ["puppet", "The group puppetmasterd should run as."], - :manifestdir => ["$confdir/manifests", - "Where puppetmasterd looks for its manifests."], - :manifest => ["$manifestdir/site.pp", - "The entry-point manifest for puppetmasterd."], - :masterlog => { :default => "$logdir/puppetmaster.log", - :owner => "$user", - :group => "$group", - :mode => 0660, - :desc => "Where puppetmasterd logs. This is generally not used, - since syslog is the default log destination." - }, - :masterhttplog => { :default => "$logdir/masterhttp.log", - :owner => "$user", - :group => "$group", - :mode => 0660, - :create => true, - :desc => "Where the puppetmasterd web server logs." - }, - :masterport => [8140, "Which port puppetmasterd listens on."], - :parseonly => [false, "Just check the syntax of the manifests."], - :node_name => ["cert", "How the puppetmaster determines the client's identity - and sets the 'hostname' fact for use in the manifest, in particular - for determining which 'node' statement applies to the client. - Possible values are 'cert' (use the subject's CN in the client's - certificate) and 'facter' (use the hostname that the client - reported in its facts)"] - ) - - self.setdefaults("puppetd", - :localconfig => { :default => "$confdir/localconfig", - :owner => "root", - :mode => 0660, - :desc => "Where puppetd caches the local configuration. An - extension indicating the cache format is added automatically."}, - :classfile => { :default => "$confdir/classes.txt", - :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 - the separate ``puppet`` executable using the ``--loadclasses`` - option."}, - :puppetdlog => { :default => "$logdir/puppetd.log", - :owner => "root", - :mode => 0640, - :desc => "The log file for puppetd. This is generally not used." - }, - :httplog => { :default => "$logdir/http.log", - :owner => "root", - :mode => 0640, - :desc => "Where the puppetd web server logs." - }, - :server => ["puppet", - "The server to which server puppetd should connect"], - :ignoreschedules => [false, - "Boolean; whether puppetd should ignore schedules. This is useful - for initial puppetd runs."], - :puppetport => [8139, "Which port puppetd listens on."], - :noop => [false, "Whether puppetd should be run in noop mode."], - :runinterval => [1800, # 30 minutes - "How often puppetd applies the client configuration; in seconds"] - ) + # Load all of the configuration parameters. + require 'puppet/configuration' # configuration parameter access and stuff def self.[](param) diff --git a/lib/puppet/configuration.rb b/lib/puppet/configuration.rb new file mode 100644 index 000000000..cfcda7120 --- /dev/null +++ b/lib/puppet/configuration.rb @@ -0,0 +1,168 @@ +# The majority of the system configuration parameters are set in this file. +module Puppet + # If we're running the standalone puppet process as a non-root user, + # use basedirs that are in the user's home directory. + conf = nil + var = nil + if self.name == "puppet" and Puppet::SUIDManager.uid != 0 + conf = File.expand_path("~/.puppet") + var = File.expand_path("~/.puppet/var") + else + # Else, use system-wide directories. + conf = "/etc/puppet" + var = "/var/puppet" + end + + self.setdefaults(:puppet, + :confdir => [conf, "The main Puppet configuration directory."], + :vardir => [var, "Where Puppet stores dynamic and growing data."] + ) + + if self.name == "puppetmasterd" + self.setdefaults(:puppetmasterd, + :logdir => {:default => "$vardir/log", + :mode => 0750, + :owner => "$user", + :group => "$group", + :desc => "The Puppet log directory." + } + ) + else + self.setdefaults(:puppet, + :logdir => ["$vardir/log", "The Puppet log directory."] + ) + end + + self.setdefaults(:puppet, + :trace => [false, "Whether to print stack traces on some errors"], + :autoflush => [false, "Whether log files should always flush to disk."], + :syslogfacility => ["daemon", "What syslog facility to use when logging to + syslog. Syslog has a fixed list of valid facilities, and you must + choose one of those; you cannot just make one up."], + :statedir => { :default => "$vardir/state", + :mode => 01777, + :desc => "The directory where Puppet state is stored. Generally, + this directory can be removed without causing harm (although it + might result in spurious service restarts)." + }, + :rundir => { :default => "$vardir/run", + :mode => 01777, + :desc => "Where Puppet PID files are kept." + }, + :lockdir => { :default => "$vardir/locks", + :mode => 01777, + :desc => "Where lock files are kept." + }, + :statefile => { :default => "$statedir/state.yaml", + :mode => 0660, + :desc => "Where puppetd and puppetmasterd store state associated + with the running configuration. In the case of puppetmasterd, + this file reflects the state discovered through interacting + with clients." + }, + :ssldir => { + :default => "$confdir/ssl", + :mode => 0771, + :owner => "root", + :desc => "Where SSL certificates are kept." + }, + :genconfig => [false, + "Whether to just print a configuration to stdout and exit. Only makes + sense when used interactively. Takes into account arguments specified + on the CLI."], + :genmanifest => [false, + "Whether to just print a manifest to stdout and exit. Only makes + sense when used interactively. Takes into account arguments specified + on the CLI."], + :configprint => ["", + "Print the value of a specific configuration parameter. If a + parameter is provided for this, then the value is printed and puppet + exits. Comma-separate multiple values. For a list of all values, + specify 'all'. This feature is only available in Puppet versions + higher than 0.18.4."], + :color => [true, "Whether to use ANSI colors when logging to the console."], + :mkusers => [false, + "Whether to create the necessary user and group that puppetd will + run as."], + :path => {:default => "none", + :desc => "The shell search path. Defaults to whatever is inherited + from the parent process.", + :hook => proc do |value| + ENV["PATH"] = value unless value == "none" + end + } + ) + + # Define the config default. + self.setdefaults(self.name, + :config => ["$confdir/#{self.name}.conf", + "The configuration file for #{self.name}."] + ) + + self.setdefaults("puppetmasterd", + :user => ["puppet", "The user puppetmasterd should run as."], + :group => ["puppet", "The group puppetmasterd should run as."], + :manifestdir => ["$confdir/manifests", + "Where puppetmasterd looks for its manifests."], + :manifest => ["$manifestdir/site.pp", + "The entry-point manifest for puppetmasterd."], + :masterlog => { :default => "$logdir/puppetmaster.log", + :owner => "$user", + :group => "$group", + :mode => 0660, + :desc => "Where puppetmasterd logs. This is generally not used, + since syslog is the default log destination." + }, + :masterhttplog => { :default => "$logdir/masterhttp.log", + :owner => "$user", + :group => "$group", + :mode => 0660, + :create => true, + :desc => "Where the puppetmasterd web server logs." + }, + :masterport => [8140, "Which port puppetmasterd listens on."], + :parseonly => [false, "Just check the syntax of the manifests."], + :node_name => ["cert", "How the puppetmaster determines the client's identity + and sets the 'hostname' fact for use in the manifest, in particular + for determining which 'node' statement applies to the client. + Possible values are 'cert' (use the subject's CN in the client's + certificate) and 'facter' (use the hostname that the client + reported in its facts)"] + ) + + self.setdefaults("puppetd", + :localconfig => { :default => "$confdir/localconfig", + :owner => "root", + :mode => 0660, + :desc => "Where puppetd caches the local configuration. An + extension indicating the cache format is added automatically."}, + :classfile => { :default => "$confdir/classes.txt", + :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 + the separate ``puppet`` executable using the ``--loadclasses`` + option."}, + :puppetdlog => { :default => "$logdir/puppetd.log", + :owner => "root", + :mode => 0640, + :desc => "The log file for puppetd. This is generally not used." + }, + :httplog => { :default => "$logdir/http.log", + :owner => "root", + :mode => 0640, + :desc => "Where the puppetd web server logs." + }, + :server => ["puppet", + "The server to which server puppetd should connect"], + :ignoreschedules => [false, + "Boolean; whether puppetd should ignore schedules. This is useful + for initial puppetd runs."], + :puppetport => [8139, "Which port puppetd listens on."], + :noop => [false, "Whether puppetd should be run in noop mode."], + :runinterval => [1800, # 30 minutes + "How often puppetd applies the client configuration; in seconds"] + ) +end + +# $Id$ |
