summaryrefslogtreecommitdiffstats
path: root/ext/module_puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-07 23:12:33 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-07 23:12:33 +0000
commitb98e65f1fd858a1d0af415554db49a121a76232c (patch)
tree728f94dd17f88902c6bdf21ff6b17486babb08af /ext/module_puppet
parentf1ffc34c0927840beeb21e1e2d864ce14de5d15e (diff)
downloadpuppet-b98e65f1fd858a1d0af415554db49a121a76232c.tar.gz
puppet-b98e65f1fd858a1d0af415554db49a121a76232c.tar.xz
puppet-b98e65f1fd858a1d0af415554db49a121a76232c.zip
There is now full support for configuration files, and the entire system has been modified to expect their new behaviour. I have not yet run the test across all test hosts, though.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@873 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'ext/module_puppet')
-rwxr-xr-xext/module_puppet61
1 files changed, 30 insertions, 31 deletions
diff --git a/ext/module_puppet b/ext/module_puppet
index 151fac4c9..388b3a1c1 100755
--- a/ext/module_puppet
+++ b/ext/module_puppet
@@ -7,9 +7,8 @@
#
# = Usage
#
-# puppet [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
-# [-l|--logfile <file>] [-p|--parse-only] <file>
-# [-c|--confdir <configuration directory>] [--vardir <var directory>]
+# puppet_module [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
+# [-l|--logdest <file>]<file>
#
# = Description
#
@@ -19,9 +18,11 @@
#
# = Options
#
-# confdir::
-# The configuration root directory, where +puppetmasterd+ defaults to looking
-# for all of its configuration files. Defaults to +/etc/puppet+.
+# Note that any configuration parameter that's valid in the configuration file
+# is also a valid long argument. For example, 'ssldir' is a valid configuration
+# parameter, so you can specify '--ssldir <directory>' as an argument.
+#
+# See the configuration file for the full list of acceptable parameters.
#
# debug::
# Enable full debugging.
@@ -29,17 +30,10 @@
# help::
# Print this help message
#
-# logfile::
+# logdest::
# Where to send messages. Choose between syslog, the console, and a log file.
# Defaults to sending messages to the console.
#
-# parse-only::
-# Just verify syntax, do not apply anything.
-#
-# vardir::
-# The variable-size directory, used for storing state. Defaults to
-# /var/puppet.
-#
# verbose::
# Print extra information.
#
@@ -65,18 +59,19 @@ rescue LoadError
$haveusage = false
end
-result = GetoptLong.new(
- [ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
+options = [
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
- [ "--noop", "-n", GetoptLong::NO_ARGUMENT ],
[ "--use-nodes", GetoptLong::NO_ARGUMENT ],
- [ "--parse-only", "-p", GetoptLong::NO_ARGUMENT ],
- [ "--vardir", GetoptLong::REQUIRED_ARGUMENT ],
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
-)
+]
+
+# Add all of the config parameters as valid options.
+Puppet.config.addargs(options)
+
+result = GetoptLong.new(*options)
debug = false
verbose = false
@@ -95,8 +90,6 @@ master = {
begin
result.each { |opt,arg|
case opt
- when "--confdir"
- Puppet[:puppetconf] = arg
when "--version"
puts "%s" % Puppet.version
exit
@@ -107,24 +100,20 @@ begin
puts "No help available unless you have RDoc::usage installed"
exit
end
- when "--noop"
- Puppet[:noop] = true
when "--use-nodes"
master[:UseNodes] = true
when "--verbose"
verbose = true
- when "--parse-only"
- parseonly = true
when "--debug"
debug = true
when "--logdest"
begin
- Puppet[:logdest] = arg
+ Puppet::Log.newdestination arg
rescue => detail
$stderr.puts detail.to_s
end
- when "--vardir"
- Puppet[:puppetvar] = arg
+ else
+ Puppet.config.handlearg(opt, arg)
end
}
rescue GetoptLong::InvalidOption => detail
@@ -136,11 +125,21 @@ rescue GetoptLong::InvalidOption => detail
end
if debug
- Puppet[:loglevel] = :debug
+ Puppet::Log.level = :debug
+ Puppet::Log.newdestination :console
elsif verbose
- Puppet[:loglevel] = :info
+ Puppet::Log.level = :info
+ Puppet::Log.newdestination :console
+end
+
+# Now parse the config
+if Puppet[:config] and File.exists? Puppet[:config]
+ Puppet.config.parse(Puppet[:config])
end
+Puppet.genconfig
+Puppet.genmanifest
+
unless ARGV.length > 0
$stderr.puts "You must pass a script to parse"
exit(14)