diff options
author | Christian Hofstaedtler <hofstaedtler@inqnet.at> | 2009-04-28 13:30:48 +0000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-05-02 09:13:29 +1000 |
commit | d85d73c570a60891607d2ce5b42dba4617f4ca6c (patch) | |
tree | 7debe0a95267268606bbbe810e7b05d7d4215e58 /lib/puppet | |
parent | d6be4e1206e9285dee9fc4d8cde9608c029d4001 (diff) | |
download | puppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.tar.gz puppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.tar.xz puppet-d85d73c570a60891607d2ce5b42dba4617f4ca6c.zip |
puppetmasterd can now run as a standard Rack application (config.ru-style)
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/application/puppetmasterd.rb | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/puppet/application/puppetmasterd.rb b/lib/puppet/application/puppetmasterd.rb index fe92bca7a..52f33cba9 100644 --- a/lib/puppet/application/puppetmasterd.rb +++ b/lib/puppet/application/puppetmasterd.rb @@ -2,6 +2,7 @@ require 'puppet' require 'puppet/application' require 'puppet/daemon' require 'puppet/network/server' +require 'puppet/network/http/rack' if Puppet.features.rack? Puppet::Application.new(:puppetmasterd) do @@ -10,6 +11,9 @@ Puppet::Application.new(:puppetmasterd) do option("--debug", "-d") option("--verbose", "-v") + # internal option, only to be used by ext/rack/config.ru + option("--rack") + option("--logdest", "-l") do |arg| begin Puppet::Util::Log.newdestination(arg) @@ -59,8 +63,6 @@ Puppet::Application.new(:puppetmasterd) do xmlrpc_handlers << :CA end - @daemon.server = Puppet::Network::Server.new(:xmlrpc_handlers => xmlrpc_handlers) - # Make sure we've got a localhost ssl cert Puppet::SSL::Host.localhost @@ -80,11 +82,21 @@ Puppet::Application.new(:puppetmasterd) do end end - @daemon.daemonize if Puppet[:daemonize] + unless options[:rack] + @daemon.server = Puppet::Network::Server.new(:xmlrpc_handlers => xmlrpc_handlers) + @daemon.daemonize if Puppet[:daemonize] + else + require 'puppet/network/http/rack' + @app = Puppet::Network::HTTP::Rack.new(:xmlrpc_handlers => xmlrpc_handlers, :protocols => [:rest, :xmlrpc]) + end Puppet.notice "Starting Puppet server version %s" % [Puppet.version] - @daemon.start + unless options[:rack] + @daemon.start + else + return @app + end end setup do @@ -96,7 +108,7 @@ Puppet::Application.new(:puppetmasterd) do Puppet::Util::Log.level = :info end - unless Puppet[:daemonize] + unless Puppet[:daemonize] or options[:rack] Puppet::Util::Log.newdestination(:console) options[:setdest] = true end |