def main
require 'etc'
Puppet::SSL::Host.localhost
Puppet::SSL::Host.ca_location = :only if Puppet::SSL::CertificateAuthority.ca?
if Puppet.features.root?
begin
Puppet::Util.chuser
rescue => detail
Puppet.log_exception(detail, "Could not change user to #{Puppet[:user]}: #{detail}")
exit(39)
end
end
unless options[:rack]
require 'puppet/network/server'
@daemon.server = Puppet::Network::Server.new(Puppet[:bindaddress], Puppet[:masterport])
@daemon.daemonize if Puppet[:daemonize]
else
require 'puppet/network/http/rack'
@app = Puppet::Network::HTTP::Rack.new()
end
Puppet.notice "Starting Puppet master version #{Puppet.version}"
unless options[:rack]
@daemon.start
else
return @app
end
end