summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-13 21:49:41 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-13 21:49:41 +0000
commit376725eb585a6b51851f9f4cbaf1a94a6b64b9fd (patch)
treed301bad3b751ff423aeda996604505eea6c11a76 /bin
parentf098485f805d65dc7ce4001655e6226eabe8269d (diff)
downloadpuppet-376725eb585a6b51851f9f4cbaf1a94a6b64b9fd.tar.gz
Adding --loadclasses option to puppet
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@906 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppet29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/puppet b/bin/puppet
index 44c500f6a..65ca8d8db 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -27,9 +27,18 @@
# debug::
# Enable full debugging.
#
+# extclassfile::
+# Specify the location of the class file to load. Only affects the
+# +--loadclasses+ option.
+#
# help::
# Print this help message
#
+# loadclasses::
+# Load any stored classes. +puppetd+ caches configured classes (usually at
+# /etc/puppet/classes.txt), and setting this option causes all of those classes
+# to be set in your +puppet+ manifest.
+#
# logfile::
# Where to send messages. Choose between syslog, the console, and a log file.
# Defaults to sending messages to the console.
@@ -65,8 +74,10 @@ end
options = [
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--extclassfile", "-e", GetoptLong::REQUIRED_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--loadclasses", GetoptLong::NO_ARGUMENT ],
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
[ "--use-nodes", GetoptLong::NO_ARGUMENT ],
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
@@ -82,6 +93,8 @@ verbose = false
noop = false
logfile = false
parseonly = false
+loadclasses = false
+classfile = nil
master = {
:Local => true
@@ -108,6 +121,10 @@ begin
verbose = true
when "--debug"
debug = true
+ when "--extclassfile"
+ classfile = arg
+ when "--loadclasses"
+ loadclasses = true
when "--logdest"
begin
Puppet::Log.newdestination(arg)
@@ -142,6 +159,18 @@ Puppet.genmanifest
master[:File] = ARGV.shift
+if loadclasses
+ file = classfile || Puppet[:classfile]
+ if FileTest.exists?(file)
+ unless FileTest.readable?(file)
+ $stderr.puts "%s is not readable" % file
+ exit(63)
+ end
+
+ master[:Classes] = File.read(file).split(/[\s\n]/)
+ end
+end
+
begin
server = Puppet::Server::Master.new(master)
client = Puppet::Client::MasterClient.new(