summaryrefslogtreecommitdiffstats
path: root/bin/puppetmasterd
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-08-23 16:09:14 +0000
committerLuke Kanies <luke@madstop.com>2005-08-23 16:09:14 +0000
commit6029ef7812765775306ff8394005c326e359d886 (patch)
tree32cbe5ea68e0e9fbdc0935d0b41e58fdfcba9e3d /bin/puppetmasterd
parente87eb58ce8dc40ba8c66233bf17cea61094e7647 (diff)
downloadpuppet-6029ef7812765775306ff8394005c326e359d886.tar.gz
puppet-6029ef7812765775306ff8394005c326e359d886.tar.xz
puppet-6029ef7812765775306ff8394005c326e359d886.zip
Moving all files into a consolidated trunk. All tests pass except the known-failing certificate test, but there appear to be some errors that are incorrectly not resulting in failurs. I will track those down ASAP.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@576 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin/puppetmasterd')
-rwxr-xr-xbin/puppetmasterd89
1 files changed, 89 insertions, 0 deletions
diff --git a/bin/puppetmasterd b/bin/puppetmasterd
new file mode 100755
index 000000000..af5da3ee5
--- /dev/null
+++ b/bin/puppetmasterd
@@ -0,0 +1,89 @@
+#!/usr/bin/ruby -w
+
+#--------------------
+# the central puppet server
+#
+# $Id$
+
+require 'getoptlong'
+require 'puppet'
+require 'puppet/server'
+
+result = GetoptLong.new(
+ [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--manifest", "-m", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--ssldir", "-s", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--noinit", "-n", GetoptLong::NO_ARGUMENT ],
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
+ [ "--noca", GetoptLong::NO_ARGUMENT ],
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ]
+)
+
+noinit = false
+ca = true
+
+result.each { |opt,arg|
+ case opt
+ when "--help"
+ puts "There is no help yet"
+ exit
+ when "--verbose"
+ Puppet[:loglevel] = :info
+ when "--debug"
+ Puppet[:debug] = true
+ when "--noca"
+ ca = false
+ when "--ssldir"
+ Puppet[:ssldir] = arg
+ when "--manifest"
+ Puppet[:manifest] = arg
+ when "--noinit"
+ noinit = true
+ when "--logfile"
+ Puppet[:masterlog] = arg
+ else
+ raise "Invalid option '#{opt}'"
+ end
+}
+
+bg = false
+
+Puppet[:autosign] = true
+
+unless Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info
+ bg = true
+end
+
+if bg
+ Puppet[:logdest] = Puppet[:masterlog]
+end
+
+begin
+ # use the default, um, everything
+ #server = Puppet::Server.new(:CA => ca)
+ server = Puppet::Server.new(
+ :Handlers => {
+ :CA => {}, # so that certs autogenerate
+ :Master => {},
+ :Status => {}
+ }
+ )
+rescue => detail
+ $stderr.puts detail
+ exit(1)
+end
+
+if bg
+ server.daemonize
+end
+
+trap(:INT) {
+ server.shutdown
+}
+begin
+ server.start
+rescue => detail
+ Puppet.err "Could not start puppetmaster: %s" % detail
+ exit(1)
+end